• No products in the cart.

Lesson 7: Loops [Instructor] PRO

Define a loop and write the first program with a loop

Lesson 7



You will want to model the activity below with a volunteer

Model: Imagine the following:

You are asked by your teacher to walk around the table

When you are done, the teacher asks you to walk around the table again

When you finish, the teacher asks you to walk around the table again

And when you finish, the teacher asks you to walk around the table again.

Prompt: Wouldn’t it have been easier for the teacher to just ask you to go around the table four times? They would have to speak less and you would know exactly how many times to walk around the table from the very beginning.

Think: What if the teacher wanted you to do it ten times? How would the teacher give the instructions so that they were more efficient and they didn’t have to repeat themselves so much? Feel free to write your instructions down on a piece of scrap paper or discuss with your neighbor.

Share: Ask a few students to share their instructions with the class, pointing out how each approach has simplified the overall approach to giving instructions.

Say: Today we’re going to work on finding ways to make giving lots of instructions easier, especially when those instructions repeat themselves a lot.


What is a Loop?

Loop – The action of doing something over and over again



New File: loops

Create a program to display 5 circles on the screen, the circle should be size 50, all same color, separated by 50 steps. Use only the commands dot and fd.

In the following code, Identify the pattern

#Identify the pattern

speed 10

dot green, 50

fd 50

dot green, 50

fd 50

dot green, 50

fd 50

dot green, 50

fd 50

dot green, 50

fd 50

Visualize the pattern visually with blocks and text

dot green, 50

fd 50

The pattern shown above will be repeated 5 times. We’ll use a loop to write the pattern just one time and command the computer to repeat as many times we want.

In pencilcode.net we find the loop under Control section

We write the pattern just one time that will be repeated 5 times using the loop

#Loop to repeat 5 times

#Result: 5 green dots

for [1..5]

dot green, 50

fd 50


Create a for loop that displays a dot and box every other time.

Here is an example code:

for [1..10]

dot green, 30

fd 30

box red, 30

fd 30

Wrap Up

What is a loop?

Why would we want to use loops?

What is a good example in which a loop would be super useful in your life?

Last Updated:7/24/2019


SEE ALL Add a note
Add your Comment
Copyright © 2016-2018 Code Rev Kids, Inc. All Rights Reserved. Code Rev Kids, Inc. and kidslovecode.com are not official Minecraft® products. They are not approved by, or associated with Mojang®. NOT AN OFFICIAL MINECRAFT PRODUCT.  NOT APPROVED BY OR ASSOCIATED WITH MOJANG.


error: Content is protected !!