Functions that return true or false
Uses a function that returns true or false directly as the if condition, so the code inside runs only when the call isAdult(age) gives back true.
Understanding Functions that return true or false in ACARA Digital Technologies Years 7–8
What it does: The comparison age >= 18 produces a boolean, and returning it means the function answers true or false. isEven(n) returns true or false, so it works as the if condition by itself. The call isAdult(age) already gives back true or false, so it can go straight inside the brackets. The second option is also missing a closing bracket. Boolean functions are often named like a yes/no question, such as isAdult, isEven or hasPassed. This makes if (isAdult(age)) easy to read. Without return, the boolean is never sent back, so an if using isAdult(age) would never run.
Common mistakes: A single = assigns instead of comparing, so the function returns 0 and never true or false. A comparison needs ===: return r === 0;. => is not a comparison operator, so this line is a syntax error. The 'greater than or equal to' operator is >=, so it should be return age >= 18;.
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 611–623) and word search (Modules 611–634).
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
if (isAdult(age))Fill in the Blanks
Spot the Error
Student with a class code? Join your class →