Totalling: how it works
Totalling keeps a running sum. Set Total to 0 before the loop, add each Value to Total inside the loop, then output Total after the loop. Counting adds 1 each time instead of the value.
Understanding Totalling: how it works in IGCSE Computer Science Paper 2
What it does: Counting adds 1 for every item, whereas totalling adds the actual value (Total ← Total + Value). Count ← Count + 1 is the counting line. Total ← 0 goes before the loop so it starts empty. If it was inside the loop, the running sum would be wiped on every repeat. A sum starts at 0 because adding 0 changes nothing. Starting at 1 would make the final answer 1 too big. Adding 1 only counts how many times the loop ran. Totalling must add each Value to the running sum.
Common mistakes: A running total must start at 0. Starting at 1 makes the final answer 1 too high. It should be Total ← 0. Total must be set to 0 before the loop. Starting with Score[1] means the first score is added twice. It should be Total ← 0.
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 275–285) and word search (Modules 275–295).
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
Total ← Total + ValueFill in the Blanks
Spot the Error
Student with a class code? Join your class →