Pseudocode FUNCTION ... RETURNS ... RETURN ... ENDFUNCTION
Starts a function that takes a typed parameter and RETURNS a value of the stated type. RETURN sends the value back, ENDFUNCTION closes it, and you can call it inside an expression.
Understanding Pseudocode FUNCTION ... RETURNS ... RETURN ... ENDFUNCTION in IGCSE Computer Science Paper 2
What it does: This shows the full structure: header with parameter and return type, an indented RETURN of a calculated value, then ENDFUNCTION. Square(5) is replaced by the value it returns (25), so it can be added to 10 and stored in Total. A procedure cannot be used like this. RETURN sends the value back to the code that called the function. OUTPUT only displays it on the screen and sends nothing back. Every FUNCTION is closed with ENDFUNCTION. ENDPROCEDURE belongs to procedures. A function header must include RETURNS followed by the data type, for example FUNCTION Double(Num : INTEGER) RETURNS INTEGER.
Common mistakes: A parameter must be written as Name : TYPE. The colon is missing, so it should be FUNCTION Sq(N : INTEGER). The function header states the type with the keyword RETURNS. RETURN is only used inside the body to send a value back. It should be RETURNS REAL.
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 123–134) and word search (Modules 123–145).
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
FUNCTION Name(Param : TYPE) RETURNS TYPEFill in the Blanks
Spot the Error
Student with a class code? Join your class →