← ACARA Digital Technologies Years 5–6

Using a count to stop a loop

A loop that keeps repeating its steps until the counter reaches the chosen number, 5. The counter must change inside the loop, or the loop never stops.

Understanding Using a count to stop a loop in ACARA Digital Technologies Years 5–6

What it does: The condition points = 5 is the stopping number. The loop keeps going until the points counter reaches 5. The line count ← count + 1 sits inside the loop, so the counter grows each time and the loop can stop at 5. The count goes 0 → 1 → 2 → 3. The steps run for the counts 0, 1 and 2. When count becomes 3, the loop stops. That is 3 times. To stop after 3 wrong answers, only wrong answers should be counted. Put wrong ← wrong + 1 inside an IF the answer is wrong.

Common mistakes: The count starts at 0, so the loop would stop straight away and never jump. The line should say REPEAT UNTIL count = 5. This adds 1 to wrong when the answer is correct. It should be IF answer ≠ 8 THEN so that only wrong answers are counted.

Class: _____________________  ·  Name: _____________________  ·  Date: _________

Free printable worksheet with full answer key — or add this module to a class and your students practise it interactively.

This module's key terms are also in a printable crossword (Modules 106–119) and word search (Modules 106–132).

Take this worksheet further — free with Cloodit

Each concept is reinforced from every angle — learned, then applied, then tested.

Learning
Duo
Which loop stops when the counter reaches 5?
REPEAT UNTIL count = 5REPEAT UNTIL count = 0 (when count starts at 1 and goes up)
Matches
count ← 0 REPEAT UNTIL count = 3 SAY "Try again"
↓
The counter never changes inside the loop, so count stays at 0 and the loop never stops. Add count ← count + 1 inside the loop.
Applying
Meanings
Term
REPEAT UNTIL count = 5
Meaning
A loop that keeps repeating its steps until the counter reaches the chosen number, 5. The counter must change inside the loop, or the loop never stops.
Practice
SET count ← 0
Testing
Gaps
REPEAT UNTIL = 5
Check Answer
Spots
1SET count ← 0
2REPEAT UNTIL count = 0

Cloodit turns curriculum-aligned coding content into journeys students work through one biome at a time.

The 'Butterfly' badge — Branch Hopper, one of Cloodit's 106 collectible badges
Students earn collectable badges

Over 100 of them, across seven natural biomes.

Study Buddy
Students build a real study resource

Turns their work into revision material ready for Flash Cards and Exam study.

Diamond Dash — one of Cloodit's live, competitive Sprint games
Students lock in with Sprints

Live, competitive practice for the start of the lesson or a teacher-led lesson finisher.

A Cloodit certificate of achievement, ready to personalise and print
Custom printable certificates

Honour your top performers, or encourage a student who's trying hard — ready to print in seconds.

Quick Questions

1. Which loop stops when the counter reaches 5?
A. REPEAT UNTIL count = 5 ✓
B. REPEAT UNTIL count = 0 (when count starts at 1 and goes up)
The loop stops when the condition count = 5 becomes true. A loop that waits for count = 0 would never stop if the counter only goes up from 1.
2. A game ends after 3 wrong answers. Which condition should the loop use?
A. REPEAT UNTIL wrong = 3 ✓
B. REPEAT UNTIL wrong = 30
The loop must stop when the wrong-answer counter reaches 3, the number we chose.
3. Inside the loop, what must happen to the counter so the loop can stop?
A. The counter can stay the same, because the loop will stop by itself
B. The counter must change, for example count ← count + 1 ✓
If the counter never changes inside the loop, the condition never becomes true and the loop never stops.
4. Which set of steps will stop? A: count ← 0, REPEAT UNTIL count = 5: say 'Go!' B: count ← 0, REPEAT UNTIL count = 5: say 'Go!', count ← count + 1
A. A
B. B ✓
A never adds 1 to count, so count stays at 0 forever. B adds 1 each time, so count reaches 5 and the loop stops.
5. A game ends at 5 points. Each right answer adds 1 point. Which step belongs inside the loop?
A. points ← points + 1 (after a right answer) ✓
B. points ← 0 (every time round the loop)
Setting points to 0 inside the loop would wipe out the score each time, so it would never reach 5. The score must grow inside the loop.

Match the Pairs

REPEAT UNTIL count = 3 → Keep repeating the steps until the counter reaches 3, for example when the player has had 3 wrong answers
count ← count + 1 → Add 1 to the counter each time round, so the loop moves closer to its stopping number
A game ends when the player reaches 5 points, so the loop stops once the score counter equals 5 → REPEAT UNTIL points = 5
The counter is changed inside the loop so it can reach the stopping number → REPEAT UNTIL count = 5 SAY "Go!" count ← count + 1
count ← 0 REPEAT UNTIL count = 3 SAY "Try again" → The counter never changes inside the loop, so count stays at 0 and the loop never stops. Add count ← count + 1 inside the loop.
REPEAT UNTIL wrong = 3 ASK question wrong ← wrong + 1 → The counter goes up every time, even when the answer is right. It should only add 1 to wrong when the answer is wrong, using an IF.

Key Term

REPEAT UNTIL count = 5
A loop that keeps repeating its steps until the counter reaches the chosen number, 5. The counter must change inside the loop, or the loop never stops.

Fill in the Blanks

1. SET count TO 0 REPEAT UNTIL count = 5 SET count TO count + 1
Hint: Type the name of the counter variable that the loop checks to know when to stop.
2. SET wrong TO 0 REPEAT UNTIL wrong = 3 IF answer is wrong, ADD 1 to wrong
Hint: Type the keyword that makes the loop keep going until the condition becomes true.
3. SET points TO 0 REPEAT UNTIL points = 5 SET points TO points + 1
Hint: Type the symbol that checks whether the points have reached the target number.
4. SET count TO 0 REPEAT UNTIL count = 5 SET count TO count + 1
Hint: Type the maths symbol that makes the counter go up each time round the loop, so the loop can stop.
5. SET wrong TO 0 REPEAT UNTIL wrong = 3 IF answer is wrong, ADD 1 to wrong
Hint: Type the number the counter should start on before any wrong answers have happened.

Spot the Error

Question 1
A SET count ← 0
B REPEAT UNTIL count = 0
C SAY "Jump!"
D SET count ← count + 1
Line B — The count starts at 0, so the loop would stop straight away and never jump. The line should say REPEAT UNTIL count = 5.
Question 2
A SET wrong ← 0
B REPEAT UNTIL wrong = 3
C ASK "What is 4 x 2?"
D IF answer = 8 THEN
E SET wrong ← wrong + 1
F SAY "Game over"
Line D — This adds 1 to wrong when the answer is correct. It should be IF answer ≠ 8 THEN so that only wrong answers are counted.
Question 3
A SET points ← 0
B REPEAT UNTIL points = 5
C SET points ← 1
D SAY points
Line C — This puts points back to 1 every time round the loop, so it never reaches 5. It should be SET points ← points + 1.
Question 4
A SET count ← 10
B REPEAT UNTIL count = 4
C SAY "Clap"
D SET count ← count + 1
Line A — The count starts at 10 and only goes up, so it can never equal 4 and the loop never stops. It should start with SET count ← 0.
Question 5
A SET tries ← 0
B REPEAT UNTIL tries = 3
C ASK "Guess the number"
D SET tries ← tries - 1
E SAY "Out of tries"
Line D — Taking 1 away makes tries go further from 3, so the loop never stops. It should be SET tries ← tries + 1.

Student with a class code? Join your class →