← ACARA Digital Technologies Years 9–10

Drawing a loop with a compound exit condition in a flowchart

A loop test using AND or OR is drawn as a back arrow to the first question, with one combined diamond or two diamonds. Both exit reasons must lead out of the loop.

Understanding Drawing a loop with a compound exit condition in a flowchart in ACARA Digital Technologies Years 9–10

What it does: Both conditions must be true to stay in the loop, so each diamond has a No exit. The arrow goes back to the first question so both are checked again. Every part of the compound test must appear in the flowchart. Either one combined diamond or two diamonds in a row can be used. With AND, one failed part makes the whole test false, so both No arrows share the same outcome.

Common mistakes: After the Yes branch, the loop needs an arrow going back up to the diamond (the first question). Going on to END means the loop never repeats. The back arrow must return to the first question, D1. Returning to D2 means lives are never checked again. It should say 'arrow back to D1'.

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 492–534) and word search (Modules 459–534).

Take this worksheet further — free with Cloodit

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

Learning
Duo
A WHILE loop test is: attempts < 3 AND password is wrong. How is it drawn?
One diamond with the whole test, or two diamonds in a row, and an arrow back to the first question when the test is trueOne diamond with only attempts < 3, and the password check is left out of the flowchart
Matches
D1: lives > 0? No -> exit. Yes -> D2: time > 0? No -> body. Yes -> body -> back to D1
↓
The No path of the second diamond goes to the body instead of leaving the loop, so running out of time never stops the loop. Both exit reasons must lead out of the loop.
Applying
Meanings
Term
compound loop exit
Meaning
A loop test using AND or OR is drawn as a back arrow to the first question, with one combined diamond or two diamonds. Both exit reasons must lead out of the loop.
Practice
tries ← 0
Testing
Gaps
Diamond: lives > 0 time > 0?
Check Answer
Spots
2Yes: input guess
3Arrow on to the END box

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

The 'Viperfish' badge — Deep Debugger, 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. A WHILE loop test is: attempts < 3 AND password is wrong. How is it drawn?
A. One diamond with the whole test, or two diamonds in a row, and an arrow back to the first question when the test is true ✓
B. One diamond with only attempts < 3, and the password check is left out of the flowchart
Every part of the compound test must appear in the flowchart. Either one combined diamond or two diamonds in a row can be used.
2. A loop stops when score >= 100 OR lives = 0. Which flowchart shows this correctly?
A. Both reasons (score >= 100 and lives = 0) lead out of the loop ✓
B. Only score >= 100 leads out of the loop and lives = 0 goes back into the loop
With OR, either exit reason is enough to stop the loop, so both must lead out.
3. What does the arrow going back in a loop flowchart point to?
A. The Start symbol at the top of the flowchart
B. The first question (diamond) of the loop test ✓
The loop returns to the first question that is asked, not to Start, so earlier steps are not repeated.
4. A REPEAT loop stops when guess = secret OR guesses = 5. How many exit reasons must the flowchart show?
A. One: the loop can only ever have one way out
B. Two: one for guess = secret and one for guesses = 5 ✓
A compound exit condition has two exit reasons, and both must be drawn leading out of the loop.
5. A loop uses two diamonds in a row to test: age >= 13 AND age <= 19. Where does a No from either diamond go?
A. To the same place, because failing either part means the whole AND test is false ✓
B. Each No goes to a different place, so the two diamonds act separately
With AND, one failed part makes the whole test false, so both No arrows share the same outcome.

Match the Pairs

WHILE lives > 0 AND time > 0 DO → Drawn as one combined diamond 'lives > 0 AND time > 0?'. Yes goes through the body and back to the diamond. No leaves the loop.
REPEAT ... UNTIL score >= 10 OR lives = 0 → A diamond after the loop body. Yes (either exit reason is true) leaves the loop. No takes the back arrow to the first step of the loop.
A WHILE loop with AND can be drawn as two diamonds in a row. A No from either diamond leaves the loop, and the back arrow returns to the first diamond. → D1: lives > 0? No -> exit. Yes -> D2: time > 0? No -> exit. Yes -> body -> arrow back to D1
A REPEAT...UNTIL loop with OR can be drawn as two diamonds whose Yes paths both lead to the same exit. The No path of the last diamond goes back to the start. → body -> score >= 10? Yes -> exit. No -> lives = 0? Yes -> exit. No -> arrow back to body
D1: lives > 0? No -> exit. Yes -> D2: time > 0? No -> body. Yes -> body -> back to D1 → The No path of the second diamond goes to the body instead of leaving the loop, so running out of time never stops the loop. Both exit reasons must lead out of the loop.
D1: lives > 0? Yes -> D2: time > 0? Yes -> body -> arrow back to D2 → The back arrow returns to the second diamond, so lives > 0 is never rechecked after the first pass. It must return to the first question.

Key Term

compound loop exit
A loop test using AND or OR is drawn as a back arrow to the first question, with one combined diamond or two diamonds. Both exit reasons must lead out of the loop.

Fill in the Blanks

1. Diamond: lives > 0 AND time > 0? Yes -> run the loop body, then back up No -> exit the loop
Hint: Type the logical operator that keeps the loop going only while both reasons are true.
2. REPEAT tries ← tries + 1 UNTIL guess = secret OR tries = 3
Hint: Type the logical operator that stops the loop when either of the two exit reasons happens.
3. Diamond 1: guess = secret? Yes -> exit Diamond 2: tries = 3? Yes -> exit Diamond 2 No -> back to Diamond 1
Hint: Type the name of the first question that the back arrow returns to.
4. WHILE NOT (score >= 50 OR lives = 0) DO PLAY round ENDWHILE
Hint: Type the logical operator that reverses the bracket so the loop runs while neither exit reason is true.
5. Process: attempts ← attempts + 1 Diamond: attempts >= 3 OR found = TRUE? Yes -> exit, No -> back to first question
Hint: Type the relational operator meaning attempts has reached 3 or gone past it.

Spot the Error

Question 1
A D: tries < 5 AND guess <> 7?
B Yes: input guess
C Arrow on to the END box
D No: leave loop
Line C — After the Yes branch, the loop needs an arrow going back up to the diamond (the first question). Going on to END means the loop never repeats.
Question 2
A D1: lives > 0?
B D1 Yes: D2 time > 0?
C D2 Yes: play, arrow back to D2
D D1 No or D2 No: exit loop
Line C — The back arrow must return to the first question, D1. Returning to D2 means lives are never checked again. It should say 'arrow back to D1'.
Question 3
A Input guess
B D: guess = 7 AND tries = 3?
C Yes: leave the loop
D No: arrow back to Input guess
Line B — There are two separate reasons to exit: a correct guess or three tries. Either one should stop the loop, so the diamond needs OR. AND would only exit when both are true.
Question 4
A Start of loop: Input pin
B D: pin <> 1234 OR tries = 3?
C Yes: arrow to exit
D No: arrow back to Input pin
Line B — The first exit reason is a correct pin, so the test must be pin = 1234. Using <> would exit the loop when the pin is wrong.
Question 5
A D1: fuel > 0?
B D1 No: exit loop
C D1 Yes: drive, back to D1
D D2 No: exit loop
E D2 Yes: drive, back to D1
Line C — With two diamonds, the Yes branch of D1 must lead to the second diamond D2. Skipping D2 means the distance is never tested, so that exit reason is lost.

Student with a class code? Join your class →