Hands-On Science Lab

Glossary › Coding › Loop

Loop

An instruction to repeat something.

For kids

Instead of writing 'step, step, step, step', you can write '4 × step'. That's a loop. Loops make programs shorter.

For grown-ups

Loops can repeat a fixed number of times (count-controlled) or until a condition is met (condition-controlled). Spotting repetition and abstracting it into a loop is a key computational thinking skill.

Try it in one minute

Write the chorus of a song once and add 'repeat 3 times'.

Common mix-up

A loop must end eventually, or the program never stops. That's called an infinite loop.

See it in an activity