Repeat a number of times
Section 5: LoopsLesson 5.1 · ⏱ 7 min
Instead of writing the same blocks many times, put them once inside repeat and write how many times. This is called a loop.

🖥️ What happens on the stage?
Robo walks and turns 4 times, so he gets back to where he started after walking in a square.
📌 Note
Without repeat you would need 8 blocks. With the loop you need only 3, and the program is easier to read and change.
📌 Another example: the triangle
3 sides, and each time he turns 120 degrees (3 × 120 = 360), so Robo gets back to the start.



✍️ Practise
Change the number to 8 and the angle to 45. What shape does Robo walk?
✍️ Practise here in the lesson✖ Close the labor open the lab in a new page ↗
🎯 Challenge yourself
Easy
Make Robo jump 3 times with repeat, then say “Done”.
👀 Show the solution🙈 Hide the solution


Medium
Make Robo switch his costume 5 times, waiting 0.3 seconds each time.
👀 Show the solution🙈 Hide the solution


Hard
Make Robo walk in a hexagon (6 sides). What is the angle? (360 ÷ 6)
👀 Show the solution🙈 Hide the solution



