Example 1
Byte must reach the star. What repeats?
- The path is straight: 5 squares.
- The same block, move forward, happens 5 times.
- So repeat 5 times: move forward.
Answer: repeat 5 times: move forward
🧩 Block coding, Grade 5 · session 2 of 14 · 60 minutes · free
When you see the same steps again and again, a loop can do them for you. A repeat block runs the blocks inside it as many times as you say: less dragging, fewer bugs.
A complete lesson · 60 minutes
Open this page with your learner and work down it, or press Teach this lesson to go through it one step at a time on a big screen. Every section has something to do.
Grade 5 · ages 9 to 11 · beginner
Warm-up · think first
"Clap, stamp, three times!" That is a loop: say the pattern once and how many times to repeat it.
Teacher tip: Do it together, then invent a pattern and say it as a loop.
Part 1 of 3 · learn, see, practise
A loop repeats a set of steps.
First spot the pattern: which steps come again and again?
Then count how many times the pattern repeats.
Byte must reach the star. What repeats?
Answer: repeat 5 times: move forward
Start with the warm-up and go as far as you can. The stretch questions are meant to be hard.
Part 2 of 3 · learn, see, practise
Put the repeating blocks inside the repeat block's mouth.
Change the number to how many times it should run.
Blocks after the loop run once, when the loop is finished.
Turn the staircase into a loop.
Answer: repeat 3 times: move forward, turn right, move forward, turn left
Start with the warm-up and go as far as you can. The stretch questions are meant to be hard.
Part 3 of 3 · learn, see, practise
Without a loop the staircase needs 12 blocks. With a loop it needs 5: the repeat block and the 4 inside it.
Fewer blocks means less to drag and fewer places for bugs to hide.
Count the repeat block itself as one block.
How many blocks does the loop save on the staircase?
Answer: 7 blocks
Start with the warm-up and go as far as you can. The stretch questions are meant to be hard.
Watch out
Inside means in the loop's mouth, indented; check the block moves with the loop when you drag it.
Trace the path with a finger and count each time the pattern ends.
Some mazes need one or two extra blocks after the loop finishes.
🖥️ Practical · puzzles 6–9
Now try it for real. Open the puzzles in a new tab and share that tab, then come back here for the activities and quiz.
▶ Open the puzzles on code.org ↗code.org is a free, non-profit coding site. Its puzzles open in your browser; an account is optional and only saves progress.
Class activity 1 of 3
Make up a dance with a loop and teach it to the learner.
🙌 No screen needed: play it together, step by step.
Class activity 2 of 3
Count the blocks. Type the number for each.
Class activity 3 of 3
Find the repeating pattern and say how many times it repeats.
After class · project
Draw a pattern on squared paper using a loop program.
What to make: A repeating pattern made from a loop.
Stretch: Put a loop inside another loop to draw rows.
| Look for | Done well when |
|---|---|
| Loop | The pattern repeats the right number of times |
| Counting | Block counts with and without the loop are right |
Copy it onto paper or print the practice sheet.
My loop: repeat ___ times: step 1: ______ step 2: ______ My drawing (stick it here) Blocks with the loop: ___ Without: ___
Homework
Try each on paper, then tap to see the answer and working. Or print the practice sheet.
repeat 6 times: hop
6
10
3
🔥 Challenge round · finished early?
Cover the notes and try these from memory. They are meant to make you think hard: draw, try small cases, and check your answer.
Solve a puzzle with a loop and then with no loop; count the difference.
Talk it through or use the drawing board. There is more than one way to get there.
Quiz · 8 questions
Pick an answer to see if it is right and why. Your best score is saved on this device.
🖨 Print what we learned
Pick what to practise, then print it or choose Save as PDF in the print window to download it.
For parents and teachers
Use it as it is, or stretch any part over two sessions. Each row links to the part of the page you need.
| Time | Part | The teacher | The learner |
|---|---|---|---|
| 0–4 min | Warm-up | Ask the warm-up question; let them act it out. | Guess, then explain. |
| 4–11 min | Patterns | Explain with the comic, reveal the example, then the practice. | Practise; try the star question. |
| 11–18 min | The repeat block | Explain, trace the example with a finger on the screen, then the practice. | Practise. |
| 18–25 min | Saving blocks | Explain and show the example, then the practice. | Practise. |
| 25–43 min | code.org practical: puzzles 6–9 | Share the code.org tab. Let the learner drive; ask them to say each block out loud before Run. | Solve the puzzles; say the plan first. |
| 43–47 min | Activity 1 | An unplugged game: get the learner moving. | Play the robot. |
| 47–51 min | Activity 2 | Do the first item together. | Finish the activity. |
| 51–54 min | Activity 3 | Quick puzzle; set the rest as homework if time is short. | Solve and check. |
| 54–59 min | Quiz | Read each question aloud; the learner taps and reads why. | Answer and explain. |
| 59–60 min | Set the project | Show the template and agree a day to share it. | Start the project. |
Colour the repeating part of the path on paper before building the loop.
Solve a puzzle with a loop and then with no loop; count the difference.
FAQ
A block that repeats the blocks inside it a set number of times, so you write a pattern once instead of copying it.
Repeat runs a fixed number of times; repeat until keeps going until something happens, like reaching the goal. That is the next lesson.
In the Classic Maze, the repeat block appears around puzzle 6.
Start a conversation
Tell us the learner's age and level. A teacher from our network teaches with these lessons; we confirm timing and price first.