Lesson 06 · 60 minutes
Doing It Again
Loops, and why repetition is not copy-paste
Today's goal
Use a repeat block to make a square, then change the square's size by editing one number.
Ideas in this lesson
- A loop says 'do this N times' instead of writing it N times
- One number to change instead of many — fewer chances to be wrong
- Loops can hold loops
- The robot's memory is finite: 100 steps, so loops buy you room
Sense → Think → Do
THINK, compressed. The same behaviour in fewer instructions.
How the session runs
- Build a square the long way: eight blocks, drive-turn-drive-turn-drive-turn-drive-turn. Run it.
- Now build it with a repeat block: repeat 4 times, containing drive and turn. Two blocks inside one.
- Compare the robot language. Same behaviour, a third of the lines.
- Change the repeat count to 3. Predict the shape before running it.
- Change the drive distance to 2 rooms. One number, bigger square.
- Put a repeat inside a repeat and see what happens. Predict first.
Sample program
A square. P 4 starts 'repeat four times', Q ends it. Everything between them happens four times.
V 5 P 4 F 900 L 350 Q
Paste it into the Workshop's Robot language box, then press Text → blocks to see it as blocks — or just send it straight to the robot.
Try this
- Make a staircase: forward, turn, forward, turn back — repeated. Get the turns to alternate.
- Make a spiral where each side is longer than the last. Can a loop do that, or do you need something else?
- What is the fewest blocks that can make a hexagon? Is it even possible with quarter turns?
When it goes wrong
| What you see | What it means |
|---|---|
| Blocks land after the repeat instead of inside it | Tap the dotted area inside the repeat block first, then tap the palette. The dotted area glows when it is aimed. |
| The square drifts into a spiral | Turns are not exactly 90°. Back to calibration — or use it: a deliberate spiral is a fine challenge. |
Notes for the grown-up
The hexagon challenge is a good trap: quarter turns cannot make 60°, so they have to notice the limitation and ask for timed spins instead. Let them hit the wall before offering the tool.