Using a BOOLEAN function in a condition
A function that RETURNS a BOOLEAN can be called straight in an IF or WHILE condition. The call gives TRUE or FALSE, so no comparison is needed.
Understanding Using a BOOLEAN function in a condition in IGCSE Computer Science Paper 2
What it does: Age >= 18 is TRUE or FALSE, so returning it directly gives the BOOLEAN result of IsAdult. A function call can be used in a loop condition. NOT placed in front of the call reverses TRUE and FALSE. CALL is only for procedures. A function is called inside an expression, so write the name and brackets without CALL. The call is already a BOOLEAN value, so adding = TRUE is redundant and bad style.
Common mistakes: An IF statement must end its condition with THEN. The line should be IF IsEven(Number) THEN. The function needs its argument in brackets. Without (Age) it has no value to test. It should be IF IsAdult(Age) THEN.
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 409–418) and word search (Modules 399–418).
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 IsEven(Number) THENFill in the Blanks
Spot the Error
Student with a class code? Join your class →