Choosing a procedure or a function for a task
Use a FUNCTION when a task produces one value the program needs, such as an area; use a PROCEDURE when it only does something, such as OUTPUT a menu.
Understanding Choosing a procedure or a function for a task in IGCSE Computer Science Paper 2
What it does: The call to the function is used in an assignment because the function returns a value that is stored in Area. Displaying a menu is an action, not a value the program needs. Actions like this are written as procedures. Functions return a value with RETURN. Procedures do not return a value. Showing a menu only does something. Calculating a total gives one value back, which suits a function. A good justification uses 'because' and links the choice to a value being returned. Returning the value lets the program store it or use it in other calculations. Outputting it only shows it on screen.
Common mistakes: Area produces one value the program needs, so it is a FUNCTION. A FUNCTION must be closed with ENDFUNCTION, not ENDPROCEDURE. Showing a menu only does something, so it is a PROCEDURE. A procedure displays with OUTPUT and does not RETURN a value. The line should be OUTPUT "1. Play".
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 419–428) and word search (Modules 419–438).
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 →