Year 3 loops go further: loops that repeat several instructions, loops mixed with other code, and nested loops — a loop inside another loop.
What your child will learn
- Work out what loops with several instructions do
- Count the actions in a nested loop
- Combine loops with other instructions
- Rewrite repeated code as a loop
Loops inside loops
A nested loop repeats a loop. “Repeat 3 × (repeat 4 × clap)” gives 3 × 4 = 12 claps. Nested loops connect coding with multiplication, which children are learning at the same age.
Example questions
Here are a few questions like the ones in the first quest. Can you solve them?
1. Which loop makes the robot do exactly these moves?
- repeat 4 × ←
- repeat 3 × ←
- repeat 2 × ←
Show answer
Answer: repeat 3 × ←. The moves ← happen 3 times, so "repeat 3 × ←" does the same job with less code.
2. How many squares does the robot move?
- 7
- 8
- 5
- 6
Show answer
Answer: 5. The loop repeats "move ↑" 5 times, so the robot moves 5 squares.
3. How many squares does the robot move?
Show answer
Answer: 12. Each time round the loop the robot moves 2 squares. 6 × 2 = 12.
4. How many claps?
- repeat 2: (repeat 3: clap)
- repeat 3: (repeat 3: clap)
- repeat 4: clap
- 9 claps
- 4 claps
- 6 claps
Show answer
Answer: repeat 2: (repeat 3: clap) → 6 claps · repeat 3: (repeat 3: clap) → 9 claps · repeat 4: clap → 4 claps. In a nested loop, multiply: 2 × 3 = 6.
Tips for grown-ups
- Act out nested loops: “3 times: do 4 jumps”.
- Ask your child to write a loop for a dance or exercise routine.