← IGCSE Computer Science Paper 2

Assignment with ← (7d)

The ← arrow stores the value on its right in the variable on its left. Total ← 0 sets Total to 0. A new assignment replaces the old value. It is not the same as = used to compare.

Understanding Assignment with ← (7d) in IGCSE Computer Science Paper 2

What it does: After the second line Score holds 8. The earlier value of 5 is lost because a new assignment replaces the old value. The value 10 on the right of the arrow goes into the variable Count on the left. The data always flows from right to left. Total + Number is 10 + 4 = 14. That result is stored back in Total, so Total is 14. ← is for assignment (storing a value). Comparing two values uses = in a condition such as IF Total = 0 THEN. Use = to compare and ← to assign. An IF condition needs a comparison, so it uses =.

Common mistakes: The arrow stores the value on its right in the variable on its left. A variable must be on the left, so this should be Number ← 5. The left side of ← must be a single variable that receives the value. The calculation goes on the right: Total ← Num1 + Num2.

Class: _____________________  ·  Name: _____________________  ·  Date: _________

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 254–264) and word search (Modules 254–274).

Take this worksheet further — free with Cloodit

Each concept is reinforced from every angle — learned, then applied, then tested.

Learning
Duo
Which line sets Total to 0 in Cambridge pseudocode?
Total ← 00 ← Total
Matches
0 ← Total
↓
The variable and the value are the wrong way round. The variable must be on the left of the arrow and the value on the right, so it should be Total ← 0.
Applying
Meanings
Term
Total ← 0
Meaning
The ← arrow stores the value on its right in the variable on its left. Total ← 0 sets Total to 0. A new assignment replaces the old value. It is not the same as = used to compare.
Practice
Total ← 0
Testing
Gaps
Total 0
Check Answer
Spots
1Total ← 0
25 ← Number

Cloodit turns curriculum-aligned coding content into journeys students work through one biome at a time.

The 'Woodland Hedgehog' badge — Import Master, one of Cloodit's 106 collectible badges
Students earn collectable badges

Over 100 of them, across seven natural biomes.

Study Buddy
Students build a real study resource

Turns their work into revision material ready for Flash Cards and Exam study.

Diamond Dash — one of Cloodit's live, competitive Sprint games
Students lock in with Sprints

Live, competitive practice for the start of the lesson or a teacher-led lesson finisher.

A Cloodit certificate of achievement, ready to personalise and print
Custom printable certificates

Honour your top performers, or encourage a student who's trying hard — ready to print in seconds.

Quick Questions

1. Which line sets Total to 0 in Cambridge pseudocode?
A. 0 ← Total
B. Total ← 0 ✓
The variable goes on the left of the arrow and the value goes on the right. Total ← 0 stores 0 in Total.
2. Total ← 5 is followed by Total ← 8. What is Total afterwards?
A. 8 ✓
B. 13
A new assignment replaces the old value. It does not add to it, so Total is now 8.
3. Which line adds Number to the running total?
A. Total ← Total + Number ✓
B. Total + Number ← Total
The right side is worked out first, then the result is stored in the variable on the left.
4. Total is 10 and Number is 4. After Total ← Total + Number, what is Total?
A. 4
B. 14 ✓
Total + Number is 10 + 4 = 14. That result is stored back in Total, so Total is 14.
5. In pseudocode, what does the ← arrow do?
A. It stores a value in a variable ✓
B. It checks if two values are equal
← is for assignment (storing a value). Comparing two values uses = in a condition such as IF Total = 0 THEN.

Match the Pairs

Total ← 0 → Stores the value 0 in the variable Total, so the total starts at zero
Total ← Total + Number → Adds Number to the current value of Total and stores the answer back in Total
Assigning a new value to a variable replaces the value it held before → Score ← 5 Score ← 8
The arrow stores the value on its right in the variable on its left → Count ← 10
0 ← Total → The variable and the value are the wrong way round. The variable must be on the left of the arrow and the value on the right, so it should be Total ← 0.
Total = 0 → In Cambridge pseudocode = is used to compare values, not to store them. To set Total to 0 you must write Total ← 0.

Key Term

Total ← 0
The ← arrow stores the value on its right in the variable on its left. Total ← 0 sets Total to 0. A new assignment replaces the old value. It is not the same as = used to compare.

Fill in the Blanks

1. Total ← 0
Hint: Type the assignment arrow that stores the value on its right into the variable on its left.
2. Total ← Total + Number
Hint: Type the arithmetic operator that adds Number to the current Total.
3. Total ← 10 Total ← Total + 5 OUTPUT Total
Hint: Type the name of the variable that now holds the updated value after both assignments.
4. IF Total = 0 THEN OUTPUT "Empty" ENDIF
Hint: Type the operator that compares two values to see if they are equal, rather than storing a value.
5. DECLARE Total : INTEGER Total ← 0
Hint: Type the name of the variable on the left that receives the starting value.

Spot the Error

Question 1
A Total ← 0
B 5 ← Number
C Total ← Total + Number
D OUTPUT Total
Line B — The arrow stores the value on its right in the variable on its left. A variable must be on the left, so this should be Number ← 5.
Question 2
A Total ← 0
B Num1 ← 4
C Num2 ← 6
D Num1 + Num2 ← Total
E OUTPUT Total
Line D — The left side of ← must be a single variable that receives the value. The calculation goes on the right: Total ← Num1 + Num2.
Question 3
A Total ← 0
B Number ← 7
C Total ← Number
D OUTPUT Total
Line C — A new assignment replaces the old value. This overwrites Total instead of adding to it. It should be Total ← Total + Number.
Question 4
A Lives ← 3
B Lives ← Live - 1
C OUTPUT Lives
Line B — The variable name is misspelt. Live is a different variable from Lives, so the line should be Lives ← Lives - 1.
Question 5
A DECLARE Age : INTEGER
B Age ← 15
C Age + 1
D OUTPUT Age
Line C — This calculates a value but never stores it, so Age does not change. It needs the assignment arrow: Age ← Age + 1.

Student with a class code? Join your class →