← IGCSE Computer Science Paper 2

Assignment with <-

The <- operator stores the value on its right in the variable on its left. Count <- 0 puts 0 into Count. It is assignment, not a test for equality.

Understanding Assignment with <- in IGCSE Computer Science Paper 2

What it does: Length * Width is calculated first and the answer is stored in Area. After the second line Score holds 15. The old value 10 is overwritten. The variable that receives the value goes on the left of <-. The value goes on the right, so Count <- 0 is correct. The calculation on the right is worked out first. The result, 15, is then stored in Score. Cambridge pseudocode uses <- for assignment. A single = is used to test whether two values are equal, so Total <- Total + Number is the correct way to update Total. To store 0 in Count you must write Count ← 0. The = sign is for comparing in conditions.

Common mistakes: Assignment uses the <- operator, not =. In Cambridge pseudocode = is a comparison, so the line should be Total <- Total + Number. The value goes on the right of <- and the variable on the left. The line should be Count <- 0.

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 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.

Learning
Duo
Which line stores the value 0 in the variable Count?
Count <- 00 <- Count
Matches
10 ← Count
↓
The value and the variable are the wrong way round. The variable must be on the left of ← and the value on the right.
Applying
Meanings
Term
Count <- 0
Meaning
The <- operator stores the value on its right in the variable on its left. Count <- 0 puts 0 into Count. It is assignment, not a test for equality.
Practice
Total <- 0
Testing
Gaps
Count 0
Check Answer
Spots
3INPUT Number
4Total = Total + Number

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

The 'Jellyfish' badge — Flow Controller, 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 stores the value 0 in the variable Count?
A. Count <- 0 ✓
B. 0 <- Count
The variable that receives the value goes on the left of <-. The value goes on the right, so Count <- 0 is correct.
2. After the line Score <- 10 + 5, what is stored in Score?
A. 10 + 5
B. 15 ✓
The calculation on the right is worked out first. The result, 15, is then stored in Score.
3. Which statement ADDS Number to the running total?
A. Total = Total + Number
B. Total <- Total + Number ✓
Cambridge pseudocode uses <- for assignment. A single = is used to test whether two values are equal, so Total <- Total + Number is the correct way to update Total.
4. Count is 3. After Count <- 7 runs, what does Count hold?
A. 7 ✓
B. 10
Assigning a new value reassigns the variable. The old value 3 is replaced, not added to, so Count now holds 7.
5. What does the <- operator do in Count <- 0?
A. It stores 0 in Count ✓
B. It tests whether Count equals 0
<- is assignment: it stores a value in a variable. It does not test anything. Testing for equality uses =, for example in an IF condition.

Match the Pairs

Count ← 0 → Stores the constant 0 in the variable Count, so Count starts at 0
Total ← Total + Number → Adds Number to the current Total and stores the new result back in Total
Assigning the result of a calculation: the right side is worked out, then stored in the variable on the left → Area ← Length * Width
Reassigning a variable: a new value replaces the old value that was stored before → Score ← 10 Score ← 15
10 ← Count → The value and the variable are the wrong way round. The variable must be on the left of ← and the value on the right.
Count = 0 → = is used instead of ←. In Cambridge pseudocode = tests whether two values are equal, it does not store a value.

Key Term

Count <- 0
The <- operator stores the value on its right in the variable on its left. Count <- 0 puts 0 into Count. It is assignment, not a test for equality.

Fill in the Blanks

1. Count <- 0
Hint: Type the assignment operator that stores the value on its right into the variable on its left.
2. Total <- Total + Number
Hint: Type the arithmetic operator that adds the new number to the running total.
3. Area <- Length * Width
Hint: Type the operator that multiplies, so the result of the calculation is stored in Area.
4. Score <- 10 Score <- Score + 5
Hint: Type the variable name that is being reassigned with a new value.
5. Lives <- 3 Lives <- Lives - 1
Hint: Type the operator that takes one away from the old value before it is stored again.

Spot the Error

Question 1
A DECLARE Total : INTEGER
B Total <- 0
C INPUT Number
D Total = Total + Number
E OUTPUT Total
Line D — Assignment uses the <- operator, not =. In Cambridge pseudocode = is a comparison, so the line should be Total <- Total + Number.
Question 2
A 0 <- Count
B Count <- Count + 1
C OUTPUT Count
Line A — The value goes on the right of <- and the variable on the left. The line should be Count <- 0.
Question 3
A DECLARE Price : REAL
B Price <- 4.50
C Price * 3 <- Cost
D OUTPUT Cost
Line C — The variable being assigned must be on the left of <-. The calculation goes on the right: Cost <- Price * 3.
Question 4
A DECLARE Score : INTEGER
B Score <= 10
C Score <- Score + 5
D OUTPUT Score
Line B — <= means less than or equal to. It is a comparison and does not store anything. Assignment needs the arrow: Score <- 10.
Question 5
A Lives -> 3
B Lives <- Lives - 1
C OUTPUT Lives
Line A — The assignment arrow points left, towards the variable receiving the value. The line should be Lives <- 3.

Student with a class code? Join your class →