← ACARA Digital Technologies Years 7–8

Logical operator !

The not operator. It reverses a boolean: !true is false and !false is true. Put it before a value or bracket, like !(score >= 50). Read it as 'not'.

Understanding Logical operator ! in ACARA Digital Technologies Years 7–8

What it does: The comparison inside the brackets is checked first, and then ! reverses its true or false answer. !isClosed reads as 'not closed'. If isClosed is true, isOpen becomes false, and if isClosed is false, isOpen becomes true. ! flips false to true. Not false means true. ! is read as 'not'. So !isRaining reads as 'not isRaining'. The brackets make ! reverse the whole comparison. Without them, ! only applies to age. ! always goes in front of the boolean it reverses, like !done or !(x > 5). isLoggedIn is true, and not true is false. Since !false is true, isNight would be true. To get false, use !true or just write false.

Common mistakes: Without brackets, ! only reverses score, not the whole comparison. Put the comparison in brackets: !(score >= 50). The symbol for 'not' in JavaScript is !, not ~. It should be !isOpen so true becomes false.

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
What does !true give?
truefalse
Matches
if (!score >= 50) {
↓
The ! is placed before score only, not before the whole bracketed comparison. It flips score first, not the result of score >= 50.
Applying
Meanings
Term
!
Meaning
The not operator. It reverses a boolean: !true is false and !false is true. Put it before a value or bracket, like !(score >= 50). Read it as 'not'.
Practice
let score = 42;
Testing
Gaps
console.log(true);
Check Answer
Spots
1let score = 42;
2let failed = !score >= 50;

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

The 'Giant Isopod' badge — Patient Builder, 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. What does !true give?
A. true
B. false ✓
The ! operator reverses a boolean, so !true becomes false.
2. What does !false give?
A. false
B. true ✓
! flips false to true. Not false means true.
3. How do you read the ! operator in plain English?
A. not ✓
B. and
! is read as 'not'. So !isRaining reads as 'not isRaining'.
4. Which line is true when score is 40: !(score >= 50) or (score >= 50)?
A. !(score >= 50) ✓
B. (score >= 50)
40 >= 50 is false, and ! reverses false to true. So !(score >= 50) is true.
5. Which code correctly reverses the whole comparison?
A. !(age > 12) ✓
B. !age > 12
The brackets make ! reverse the whole comparison. Without them, ! only applies to age.

Match the Pairs

!true → Gives false, because ! reverses the boolean value
!(score >= 50) → True when score is NOT 50 or more, so score is below 50
Put ! before brackets to reverse the result of a whole comparison → let failed = !(mark >= 50);
Reading ! as 'not': let isOpen be the opposite of isClosed → let isOpen = !isClosed;
if (!score >= 50) { → The ! is placed before score only, not before the whole bracketed comparison. It flips score first, not the result of score >= 50.
let isNight = !false; // want false → !false reverses false into true, not false. The programmer forgot that ! flips the value.

Key Term

!
The not operator. It reverses a boolean: !true is false and !false is true. Put it before a value or bracket, like !(score >= 50). Read it as 'not'.

Fill in the Blanks

1. console.log(!true);
Hint: Type the operator that reverses a boolean, read as 'not'.
2. let isDone = false; console.log(!isDone);
Hint: Type the operator that flips false into true.
3. let score = 40; let failed = !(score >= 50); console.log(failed);
Hint: Type the operator that goes before the bracket to reverse the whole comparison.
4. let isOpen = true; let isClosed = !isOpen; console.log(isClosed);
Hint: Type the variable whose boolean value is being reversed.
5. let raining = false; if (!raining) console.log("Go outside");
Hint: Type the variable name that the not operator reverses in the condition.

Spot the Error

Question 1
A let score = 42;
B let failed = !score >= 50;
C console.log(failed);
Line B — Without brackets, ! only reverses score, not the whole comparison. Put the comparison in brackets: !(score >= 50).
Question 2
A let isOpen = true;
B let isClosed = ~isOpen;
C console.log(isClosed);
Line B — The symbol for 'not' in JavaScript is !, not ~. It should be !isOpen so true becomes false.
Question 3
A let age = 15;
B let isAdult = age >= 18;
C if (!isAdult {
D console.log("Minor");
E }
Line C — The closing bracket of the if condition is missing. It should be if (!isAdult) {.
Question 4
A let score = 30;
B let target = 50;
C let passed = score >= target;
D let failed = !!passed;
E console.log(failed);
Line D — Two ! symbols reverse the boolean twice, so failed would just equal passed. Use one !, read as 'not': !passed.
Question 5
A let hasTicket = true;
B let late = false;
C if (hasTicket && late!) {
D console.log("Enter");
E }
Line C — The ! operator goes before the value, not after it. It should be !late, read as 'not late'.

Student with a class code? Join your class →