Writing relevant and appropriate comments
A good comment explains why a section of code exists or a tricky step, without repeating the code word for word. Put it at the same indentation as the code it describes.
Understanding Writing relevant and appropriate comments in IGCSE Computer Science Paper 2
What it does: The comment lines up with the INPUT line below it, so the reader can see which code it belongs to. It explains the reason for MOD 2 instead of repeating the code word for word. Explaining why the check exists helps the reader. Repeating the condition in words adds nothing. Too many pointless comments clutter the program and hide the useful ones. The first comment gives the purpose of the MOD step. The second is wrong and describes what the line does not do. Comments should summarise the purpose of a section, not duplicate the code line by line. The number -1 has no obvious meaning on its own, so the comment explains why it is used.
Common mistakes: The comment just repeats the code in symbols, so it adds nothing. A good comment gives the purpose, for example // Work out the price with VAT. Cambridge pseudocode comments start with //, not #. Without // the line is not a valid comment. It should be // Check if the student passed.
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 347–357) and word search (Modules 337–357).
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
// explain purposeFill in the Blanks
Spot the Error
Student with a class code? Join your class →