Changing code in one place
Code kept in one subroutine is edited once, so every CALL gets the update. Repeated copies must each be changed, and missing one gives inconsistent results.
Understanding Changing code in one place in IGCSE Computer Science Paper 2
What it does: Every call runs the same ShowScore code, so correcting the bug inside ShowScore corrects every call. One line was updated to 1.20 but the other still uses 1.15, so the program gives different results for the same rule. The rate is stored in one place, the function. Every CALL uses the updated function, so you only edit it once. Repeated copies are separate pieces of code. Each one must be edited by hand. The benefit is easier maintenance: less editing and fewer inconsistent results. It is not about speed. Mixing a call with a copied calculation means the copy is missed when the function is changed. Both lines should call AddTax.
Common mistakes: A function returns a value, so it is used inside an expression or OUTPUT, not with CALL. It should be OUTPUT Tax(50). Once the rate is changed inside Tax, this call gets the update. A function must RETURN its result so every call can use it. It should be RETURN P * 0.25. The rate is changed once here and both calls get the new value.
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 439–448) and word search (Modules 439–458).
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
single point of changeFill in the Blanks
Spot the Error
Student with a class code? Join your class →