Skip to content

Beginning of the lesson

Repetition: Loops

How computers repeat work without copying the same instruction over and over

Big Idea: Computers are amazing at doing the same thing again and again without ever getting tired or bored. A loop is a smart way to say "do this again" so we do not have to write the same instruction many times.
By the end you will be able to:
  • say what a loop is in simple words,
  • explain why a loop is better than copying an instruction,
  • read a simple loop diagram and count how many times a loop repeats.

1. What is a loop?

A loop is an instruction that says: "Do this again." Instead of telling the computer the same step over and over, we tell it once and say how many times to repeat it.

Imagine you want a computer to clap 10 times. You could write "clap" ten times in a row. That works, but it is a lot of writing! With a loop you simply say: "Repeat 10 times: clap." Short, clear, and easy to change.

The words that get repeated are called the body of the loop. The number tells the computer how many times to run the body.

2. Why not just copy the instruction?

You could copy the same instruction many times, but a loop is much better. Look at the difference:

Copying by handUsing a loop
clap
clap
clap
clap
clap
(...and 5 more times)
Repeat 10 times: clap

A loop is better because it is:

  • Shorter — one line instead of ten.
  • Safer — if you copy by hand you might miss one or add an extra. A loop counts perfectly.
  • Easy to change — want 100 claps instead of 10? Just change the number from 10 to 100.

Continue this lesson on YourAIZone

The full lesson has the complete explanation, worked examples, common mistakes, tests with instant checking and an AI tutor. Start right away as a guest, or create an account to keep your progress.

In the full lesson

  • The complete explanation
  • Worked examples
  • Common mistakes and how to avoid them
  • Test questions: 15
  • AI tutor that answers questions about the topic
  • Progress tracking for students, parents and teachers