← ACARA Digital Technologies Years 7–8

Assignment = versus equality ===

A single = stores a value in a variable (x becomes 5). Triple === compares two values and gives true or false (x is equal to 5). Writing if (x = 5) is a bug.

Understanding Assignment = versus equality === in ACARA Digital Technologies Years 7–8

What it does: The line reads 'lives becomes 3'. The single = is assignment, so it stores the value. The triple === compares lives with 0, so the if can decide whether the condition is true or false. === is a comparison. It asks a question and gives true or false. It does not change age. if (x = 5) is a bug because it stores 5 in x instead of comparing. Use === inside the brackets of an if. === compares and gives a boolean. 8 is not equal to 5, so the result is false. It never changes x. Only a single = changes what a variable holds. level === 2 just checks and leaves level alone.

Common mistakes: A single = stores a value, so this sets score to target instead of comparing them. To ask 'is equal to' you need ===: if (score === target) {. if (lives = 0) stores 0 in lives instead of checking it. The condition should compare with ===: if (lives === 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 583–598) and word search (Modules 583–613).

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 10 in the variable score?
score === 10;score = 10;
Matches
if (x = 5) {
↓
A single = assigns 5 to x instead of comparing. The condition should use === to ask 'is x equal to 5?'
Applying
Meanings
Term
= vs ===
Meaning
A single = stores a value in a variable (x becomes 5). Triple === compares two values and gives true or false (x is equal to 5). Writing if (x = 5) is a bug.
Practice
let score = 10;
Testing
Gaps
let score 10;
Check Answer
Spots
3console.log("Checking");
4if (score = target) {

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

The 'Puffin' badge — Definition Diver, 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 10 in the variable score?
A. score = 10; ✓
B. score === 10;
A single = is assignment. Read it as 'becomes', so score becomes 10.
2. Which expression checks whether score is equal to 10?
A. score === 10 ✓
B. score = 10
=== compares two values and gives true or false. A single = would store 10 in score instead.
3. How should you read this line aloud: lives = 3;
A. lives is equal to 3
B. lives becomes 3 ✓
A single = stores a value, so read it as 'becomes'. Reading === as 'is equal to' is for comparing.
4. How should you read this condition aloud: age === 13
A. age is equal to 13 ✓
B. age becomes 13
=== is a comparison. It asks a question and gives true or false. It does not change age.
5. Which if statement is written correctly to check if x is 5?
A. if (x = 5) {
B. if (x === 5) { ✓
if (x = 5) is a bug because it stores 5 in x instead of comparing. Use === inside the brackets of an if.

Match the Pairs

let score = 10; → Stores the value 10 in the variable score (score becomes 10)
score === 10 → Checks if score is equal to 10 and gives true or false
Read = as 'becomes' when you store a value in a variable → let lives = 3;
Use === inside an if to ask 'is it equal to?' → if (lives === 0) {
if (x = 5) { → A single = assigns 5 to x instead of comparing. The condition should use === to ask 'is x equal to 5?'
let age === 13; → === compares values, so it cannot store 13 in age. A single = is needed to assign the value.

Key Term

= vs ===
A single = stores a value in a variable (x becomes 5). Triple === compares two values and gives true or false (x is equal to 5). Writing if (x = 5) is a bug.

Fill in the Blanks

1. let score = 10;
Hint: Type the single symbol that stores a value in a variable (read it as 'becomes').
2. let score = 10; if (score === 10) console.log("Win");
Hint: Type the operator that checks if two values are equal inside the if condition.
3. let lives = 0; console.log(lives === 0);
Hint: Type the operator that compares two values and gives true or false.
4. let isReady = false; isReady = true; console.log(isReady);
Hint: Type the single symbol that gives the variable a new value.
5. let n = 7; if (n === 7) { console.log("Lucky"); }
Hint: Type the comparison operator so the if checks the value instead of changing it.

Spot the Error

Question 1
A let score = 10;
B let target = 10;
C console.log("Checking");
D if (score = target) {
E console.log("Match!");
F }
Line D — A single = stores a value, so this sets score to target instead of comparing them. To ask 'is equal to' you need ===: if (score === target) {
Question 2
A let lives = 3;
B console.log("Start");
C if (lives = 0) {
D console.log("Game over");
E }
Line C — if (lives = 0) stores 0 in lives instead of checking it. The condition should compare with ===: if (lives === 0) {
Question 3
A let x = 2;
B let y = 3;
C console.log(x);
D x === y + 1;
E console.log(x);
Line D — This line should store a new value in x, so it needs a single = (x becomes y + 1). === only compares and would leave x unchanged. Correct line: x = y + 1;
Question 4
A let password = "abc";
B let guess = "abc";
C if (guess = password) {
D console.log("Welcome");
E }
Line C — A single = overwrites guess with password, so the check is not a real comparison. Use === to ask if they are equal: if (guess === password) {
Question 5
A let lives;
B lives === 3;
C console.log(lives);
Line B — To give lives a value you read = as 'becomes': lives = 3;. === only compares two values and does not store anything.

Student with a class code? Join your class →