A WHILE loop with a compound condition
The loop repeats only while BOTH tests are TRUE. As soon as either test becomes FALSE, the whole condition is FALSE and the loop stops.
Understanding A WHILE loop with a compound condition in ACARA Digital Technologies Years 9–10
What it does: The condition is TRUE only while both tests are TRUE. A third attempt or a correct answer makes one test FALSE, which ends the loop. The index has gone past the end of the list. Index <= 10 is FALSE, so the AND condition fails even though the item was never found. The search must keep going while the item is NOT found, so Found needs NOT in front of it.
Common mistakes: The loop should continue only while BOTH tests are TRUE. With OR, it keeps going if either test is TRUE. If the item is never found, NOT Found stays TRUE, so the loop never stops. It should be AND. Lives must start above 0. If Lives starts at 0, Lives > 0 is FALSE straight away, so the whole AND condition is FALSE and the loop never runs. It should be Lives ← 3.
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.
Cloodit turns curriculum-aligned coding content into journeys students work through one biome at a time.
Over 100 of them, across seven natural biomes.
Turns their work into revision material ready for Flash Cards and Exam study.
Live, competitive practice for the start of the lesson or a teacher-led lesson finisher.
Honour your top performers, or encourage a student who's trying hard — ready to print in seconds.
Quick Questions
Match the Pairs
Key Term
WHILE Attempts < 3 AND Correct = FALSE DOFill in the Blanks
Spot the Error
Student with a class code? Join your class →