Loops for kids: HDB Void Deck
Water every plant along the corridor without dragging out 20 arrows.
Free · no sign-up · ages 6–12 · works on Chromebooks and iPads
What are loops?
A loop tells the computer to do the same thing again and again. Instead of writing "move right" nine times, you write it once and wrap it in "repeat 9". Loops make programs shorter and easier to read, and much easier to change. If the corridor grows to 20 squares, you change one number instead of adding eleven blocks.
At the HDB void deck, the neighbours have lined the corridor with potted plants, and your robot is on watering duty. The first levels can be solved the long way, with lots of arrows. To earn all three stars, you have to spot the pattern that repeats and put it in a loop.
Spotting patterns is one of the most useful skills in coding. Later levels put a loop inside another loop (a "nested loop") to walk up and down rows, the same trick programmers use to go through every pixel in a picture or every cell in a spreadsheet.
The levels
- Level 1 To the Lift The lift lobby is at the end of the void deck. Get there using a "repeat" block.
- Level 2 Thirsty Plants Every square along the corridor has a plant. Step and water, step and water…
- Level 3 Every Other Pot Now the plants are spread out. Find the pattern that repeats.
- Level 4 Staircase The plants go down the stairs. The pattern is a bit longer this time.
- Level 5 There and Back Water the top row, then come back along the bottom row. You need two loops.
- Level 6 Snake Walk Four rows of plants! Your two loops from the last level can go inside another loop.
- Secret bonus Corridor Marathon Get three stars on all six levels to unlock it.
Teachers: link straight to any level, like dotcodecampus.com/maze/void-deck/3, and put it up on the projector.
Ready to Start Building?
Book a free 45-minute trial class. No commitment, no credit card — just great learning.
