Counting down with a for loop
A for loop that counts down: start i high, keep going while i >= 1, and subtract 1 each time with i--. Use i -= 2 to count down in steps of 2.
Understanding Counting down with a for loop in ACARA Digital Technologies Years 7–8
What it does: The condition i >= 1 stays true until i drops to 0, so the loop prints 10 down to 1. i-- takes 1 off i after each repeat. This moves the counter down towards the end of the loop. i-- subtracts 1 each time, so i gets smaller. i++ would add 1 and the loop would never stop. i starts at 3 and goes down by 1 each time, so the console shows 3, then 2, then 1. The condition i <= 1 is false when i starts at 10, so the loop body is skipped. A countdown needs i >= 1.
Common mistakes: i++ adds 1 each time, so i goes up (11, 12, ...) and i >= 1 stays true forever. A countdown must use i-- to subtract 1 each time. A countdown must start high. Starting at 1 makes i >= 10 false straight away, so the loop never runs. It should be let i=10 and i>=1.
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 599–610) and word search (Modules 583–613).
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
for (let i = 10; i >= 1; i--)Fill in the Blanks
Spot the Error
Student with a class code? Join your class →