Function
A named subroutine that returns a single value to the place where it is called, so the call can be used inside an expression, such as x ← Total(2, 3).
Understanding Function in IGCSE Computer Science Paper 2
What it does: Double(4) is replaced by the value it returns (8), so it can be added to 1 like any other value. RETURNS BOOLEAN states that the single value coming back will be TRUE or FALSE. A function always returns one value. A procedure does not return a value. A function call produces a value, so it can be stored in a variable with an assignment. CALL is used for procedures. The call is replaced by the returned value 5 in the expression, so 5 + 1 = 6 is output.
Common mistakes: The header must say RETURNS before the data type of the value that comes back. It should be FUNCTION Pi() RETURNS REAL. A function must send its value back to the call with RETURN. OUTPUT only displays it and nothing comes back. It should be RETURN Result.
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 389–398) and word search (Modules 379–398).
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
FUNCTIONFill in the Blanks
Spot the Error
Student with a class code? Join your class →