Stairs
You can put more than one block in a loop. On every pass, all of them are carried out, from top to bottom, and only then does the next pass start. The loop
Repeat 2 timesMove forwardTurn right ↻
therefore does: forward, right, forward, right. Not forward, forward, right, right.
Remember the stairs from the Repeating Moves exercise. The four moves that repeated there are exactly what belongs in a loop. Now the stairs are higher: five stairs would take twenty blocks without a loop, but five blocks are enough with one.
On the last stair, the dog turns left even though it doesn't need to. That's fine: it's at the goal, just facing another way. A loop does every pass the same way, and that's all right as long as the result is what the task asks for.
Instructions
- 1
Climb the stairs to the goal.
- 2
Use at most 5 blocks.