Choosing a variable or a constant
Use CONSTANT for a value fixed while the program runs, e.g. VAT rate or pi. Use a variable (DECLARE) for a value that changes or is input, e.g. score or answer.
Understanding Choosing a variable or a constant in IGCSE Computer Science Paper 2
What it does: A value that stays the same throughout the program is declared with CONSTANT, as Pi is here. The VAT rate is fixed for the whole run of the program, so it should be a constant. Being a REAL number does not decide it. Pi never changes, so use a constant. A value entered by the user is not known in advance and can differ each time, so use a variable. Constants hold fixed values. Values that are input belong in variables. Lives left changes during play. The days in a week is fixed, so it suits a constant. DECLARE creates a variable, which is the right choice when the value changes during the program.
Common mistakes: Price is entered by the user, so its value changes. It must be a variable, DECLARE Price : REAL, not a CONSTANT. The VAT rate is fixed while the program runs, so it should be a constant: CONSTANT VATRate ← 0.2.
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 317–326) and word search (Modules 317–336).
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
CONSTANTFill in the Blanks
Spot the Error
Student with a class code? Join your class →