Storing a function result in a variable
The function runs, and the value it returns is stored in the variable on the left of the arrow. You can use that variable later. Its type must match the function's return type.
Understanding Storing a function result in a variable in IGCSE Computer Science Paper 2
What it does: SumSquare returns an INTEGER, so Total is declared as INTEGER to match the return type. Each call runs the function with its own arguments and returns its own value, which is stored in its own variable.
Common mistakes: The arrow assigns the value on its right to the variable on its left. The variable must be on the left: Total ← SumSquare(3, 4). The variable that stores the returned value is Area. Aera is a misspelled name that was never assigned. It should be OUTPUT "Area is ", Area.
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
Total ← SumSquare(3, 4)Fill in the Blanks
Spot the Error
Student with a class code? Join your class →