What a subroutine is
A named block of code, written once, that runs whenever it is called. Procedures and functions are the two kinds, and they break a program into parts.
Understanding What a subroutine is in IGCSE Computer Science Paper 2
What it does: A function is a subroutine that uses RETURN to send a value back, while a procedure does not return a value. One definition is reused by three calls, so the code is written once but run three times. A subroutine is a named block of statements. It does not store data like a variable does; it runs when you call it. A subroutine is defined once. Each time you need it, you call it by name instead of rewriting the code. Procedures and functions are the two kinds of subroutine. Loops and arrays are different programming ideas. Subroutines divide a large program into smaller parts. Each part has a name and does one job.
Common mistakes: A subroutine is defined with the keyword PROCEDURE (or FUNCTION), not SUBROUTINE. The first line should be PROCEDURE Countdown(). Text to be displayed must be in quotation marks. The line should be OUTPUT "Welcome!". The procedure is written once and then called twice.
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
subroutineFill in the Blanks
Spot the Error
Student with a class code? Join your class →