Hands-On Science Lab

Sections › Coding › Loops and debugging

Loops and debugging

Loops save repeating yourself. Debugging is finding exactly where things went wrong. Both are everyday thinking tools.

What it looks like at each age

Ages 4–7

Spotting repeated patterns in songs and dances.

Ages 8–11

Shortening programs with loops, finding the line with the bug.

Ages 12–15

Nested loops, systematic testing, explaining bugs clearly.

Three things to try this week

  1. Find the repeating part of a favourite song.
  2. Write a dance as a program with loops.
  3. When something breaks, ask 'Which step went wrong?'

Activities for this topic

Words to know

Loop
An instruction to repeat something.
Bug
A mistake in a program that makes it do the wrong thing.