Loop Dance

REPEAT: the computer's favourite word


Year 7 Computer Science

Spot the Pattern!

Clap, Clap, Stamp, Clap, Clap, Stamp, Clap, Clap, Stamp, Clap, Clap, Stamp


What's the repeating pattern? How could we write this more simply?


REPEAT 4 TIMES {
    Clap
    Clap
    Stamp
}

12 actions → written as 1 loop. 4 × 3 = 12 ✓

REPEAT Notation

REPEAT 4 TIMES {
    Clap        ← body
    Clap
    Stamp
}
Class Dance Time!

As a class: vote on 3 moves.

Write the loop on the board together.

Perform it — follow the algorithm exactly!


Don't anticipate. Don't improvise. Just execute.

Nested Loops

REPEAT 3 TIMES {       ← outer
    REPEAT 2 TIMES {  ← inner
        Clap
        Stamp
    }
    Jump
}

Inner loop runs fully each time the outer loop iterates.

Total: 3 × (2×2 + 1) = 3 × 5 = 15 actions

Group Challenge

Perform!

SWAP worksheets with another group.

Follow their algorithm exactly — don't ask for help.

Authors: watch silently. Note what matches and what doesn't.

Key Takeaway

Loops avoid repetition — write the pattern once, tell the computer how many times.

Nested loops multiply the repetitions.

Count-controlled = fixed number. Condition-controlled = runs until something changes.
1 / 8