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
}
- The number says how many times
- The { curly braces } hold the body
- The body runs completely before the count increases
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
- Groups of 3–4. Use the worksheet.
- Choose 3 moves and design your routine
- Must include at least one nested loop
- Write the algorithm — clear enough for another group to perform without your help
- Calculate the total number of actions
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
← → or click to advance