← ACARA Digital Technologies Years 7–8

Shorthand updates: +=, -= and ++

A shorthand update. Operators like +=, -=, ++ and -- change a variable using its own value, so total += price means total = total + price. count++ adds 1 and count-- takes away 1.

Understanding Shorthand updates: +=, -= and ++ in ACARA Digital Technologies Years 7–8

What it does: The ++ operator is the quickest way to add 1 to a variable and it means the same as count = count + 1. += adds the value on its right to the variable. The operator is written +=, with the plus first. =+ is not a shorthand update. ++ is shorthand for count = count + 1. It always adds exactly 1. -- is the decrement operator and it takes away 1. A single - on its own is not a valid statement. score += 5 means score = score + 5, so 10 + 5 = 15. The old value is kept and added to.

Common mistakes: A const variable cannot be changed, so count++ would cause a TypeError. Use let count = 0; for a variable that gets updated. The operator is += (plus first, then equals). =+ just assigns positive 5, so total becomes 5 instead of 15. It should be total += 5;.

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 562–580) and word search (Modules 522–580).

Take this worksheet further — free with Cloodit

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

Learning
Duo
Which line does the same job as total = total + price;?
total =+ price;total += price;
Matches
total =+ price;
↓
The symbols are the wrong way round. =+ just assigns a positive price to total instead of adding it. It should be +=.
Applying
Meanings
Term
total += price
Meaning
A shorthand update. Operators like +=, -=, ++ and -- change a variable using its own value, so total += price means total = total + price. count++ adds 1 and count-- takes away 1.
Practice
let total = 10;
Testing
Gaps
total 5;
Check Answer
Spots
1const count = 0;
2count++;

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 does the same job as total = total + price;?
A. total += price; ✓
B. total =+ price;
+= adds the value on its right to the variable. The operator is written +=, with the plus first. =+ is not a shorthand update.
2. What does count++; do to the variable count?
A. Adds 2 to count
B. Adds 1 to count ✓
++ is shorthand for count = count + 1. It always adds exactly 1.
3. Which statement takes 1 away from lives?
A. lives--; ✓
B. lives-;
-- is the decrement operator and it takes away 1. A single - on its own is not a valid statement.
4. let score = 10; score += 5; What is score now?
A. 15 ✓
B. 5
score += 5 means score = score + 5, so 10 + 5 = 15. The old value is kept and added to.
5. Which is the same as x = x + 1;?
A. x+1;
B. x++; ✓
x++ changes x itself. x+1; works out an answer but never stores it back in x.

Match the Pairs

total += price; → Adds the value of price to total and stores the answer back in total
count--; → Takes 1 away from count
Add 1 to the variable count using the shortest form → count++;
Write score = score - 5 in its shorthand form → score -= 5;
total =+ price; → The symbols are the wrong way round. =+ just assigns a positive price to total instead of adding it. It should be +=.
let count = 0; count+; → count+ is not a valid operator. To add 1 you need two plus signs, count++, or you can write count += 1.

Key Term

total += price
A shorthand update. Operators like +=, -=, ++ and -- change a variable using its own value, so total += price means total = total + price. count++ adds 1 and count-- takes away 1.

Fill in the Blanks

1. let total = 0; total += 5; console.log(total);
Hint: Type the shorthand operator that adds a value to the variable itself.
2. let lives = 3; lives--; console.log(lives);
Hint: Type the operator that takes 1 away from the variable.
3. let count = 0; count = count + 1; count++;
Hint: Type the variable name that the longhand update must use on the right side, just like count++ does.
4. const price = 8; let money = 20; money -= price;
Hint: Type the shorthand operator that subtracts the price from the variable itself.
5. const price = 6; let total = 0; total += price;
Hint: Type the name of the variable that is being updated by the shorthand operator.

Spot the Error

Question 1
A const count = 0;
B count++;
C console.log(count);
Line A — A const variable cannot be changed, so count++ would cause a TypeError. Use let count = 0; for a variable that gets updated.
Question 2
A let total = 10;
B total =+ 5;
C console.log(total);
Line B — The operator is += (plus first, then equals). =+ just assigns positive 5, so total becomes 5 instead of 15. It should be total += 5;
Question 3
A let score = 0;
B score += 10;
C score+;
D console.log(score);
Line C — The increase operator needs two plus signs. A single + is a syntax error. It should be score++;
Question 4
A let total;
B total += 4;
C total += 6;
D console.log(total);
Line A — Without a starting value, total is undefined, and undefined + 4 gives NaN. A running total must start at 0: let total = 0;
Question 5
A let lives = 3;
B lives =- 1;
C console.log(lives);
Line B — The operator is -= (minus first, then equals). =- assigns -1, so lives becomes -1 instead of 2. It should be lives -= 1;

Student with a class code? Join your class →