← ACARA Digital Technologies Years 7–8

Logical operator ||

Logical OR joins two conditions. It is true when at least one is true, and false only when both are false. Example: day === 'Sat' OR day === 'Sun' is true on a weekend.

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

What it does: The condition is true if the score is 0 or the score is 100. Only one has to be true, which is how || works. 5 > 10 is false and 2 > 8 is false, so the || result is false and the console shows false. || is true when at least one side is true. day === "Sat" is true, so the whole condition is true. Only one side needs to be true for || to give true. Each side of || needs its own full condition. "Sun" on its own is not a comparison with day. Both sides are false (Wed is not Sat and not Sun), so the || result is false.

Common mistakes: A single | is a different (bitwise) operator. OR needs two bars, so it should be console.log(sat || sun);. Each side of || must be a full condition. The right side is missing temp, so it should be temp > 35.

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
If day is "Sat", what does day === "Sat" || day === "Sun" give?
falsetrue
Matches
if (day === "Sat" || "Sun") {
↓
The right side of || is just the text "Sun", not a comparison. Each side of || needs its own full condition.
Applying
Meanings
Term
logical OR
Meaning
Logical OR joins two conditions. It is true when at least one is true, and false only when both are false. Example: day === 'Sat' OR day === 'Sun' is true on a weekend.
Practice
let day = "Sat";
Testing
Gaps
let off = day === "Sat" day === "Sun";
Check Answer
Spots
3let sun = day === "Sun";
4console.log(sat | sun);

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

The 'Manta Ray' badge — Graceful Coder, 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. If day is "Sat", what does day === "Sat" || day === "Sun" give?
A. false
B. true ✓
|| is true when at least one side is true. day === "Sat" is true, so the whole condition is true.
2. Which result does true || false give?
A. false
B. true ✓
Only one side needs to be true for || to give true.
3. When is a || b false?
A. Only when both a and b are false ✓
B. When either a or b is false
|| is false only when both conditions are false. One true side is enough to make it true.
4. Which line correctly checks if day is Sat or Sun?
A. day === "Sat" || day === "Sun" ✓
B. day === "Sat" || "Sun"
Each side of || needs its own full condition. "Sun" on its own is not a comparison with day.
5. If day is "Wed", what does day === "Sat" || day === "Sun" give?
A. false ✓
B. true
Both sides are false (Wed is not Sat and not Sun), so the || result is false.

Match the Pairs

day === "Sat" || day === "Sun" → True when the day is Saturday or Sunday, so it is true on the weekend
false || false → Gives false, because || is false only when both sides are false
Either one of two conditions is enough to make the whole condition true → score === 0 || score === 100
|| gives false only when both conditions are false → console.log(5 > 10 || 2 > 8);
if (day === "Sat" || "Sun") { → The right side of || is just the text "Sun", not a comparison. Each side of || needs its own full condition.
if (day === "Sat" | day === "Sun") { → OR is written with two vertical bars ||. A single | is a different operator.

Key Term

logical OR
Logical OR joins two conditions. It is true when at least one is true, and false only when both are false. Example: day === 'Sat' OR day === 'Sun' is true on a weekend.

Fill in the Blanks

1. let off = day === "Sat" || day === "Sun";
Hint: Type the OR operator that is true when at least one day check is true.
2. if (day === "Sat" || day === "Sun") { console.log("Weekend!"); }
Hint: Type the keyword that starts a conditional statement.
3. let hasPass = false; let hasTicket = true; let canEnter = hasPass || hasTicket;
Hint: Type the operator that lets a person in if either condition is true.
4. if (score < 0 || score > 100) { console.log("Invalid"); }
Hint: Type the comparison operator that checks if the score is too high.
5. let isSat = day === "Sat"; let isSun = day === "Sun"; let off = isSat || isSun;
Hint: Type the variable name that holds the Sunday check.

Spot the Error

Question 1
A let day = "Sun";
B let sat = day === "Sat";
C let sun = day === "Sun";
D console.log(sat | sun);
Line D — A single | is a different (bitwise) operator. OR needs two bars, so it should be console.log(sat || sun);
Question 2
A let temp = 38;
B if (temp < 0 || > 35) {
C console.log("Extreme");
D }
Line B — Each side of || must be a full condition. The right side is missing temp, so it should be temp > 35.
Question 3
A let age = 9;
B if (age < 5 or age > 65) {
C console.log("Free entry");
D }
Line B — JavaScript does not use the word or. The OR operator is written ||, so it should be age < 5 || age > 65.
Question 4
A let hasPen = false;
B let hasPencil = true;
C if hasPen || hasPencil {
D console.log("Can write");
E }
Line C — The condition of an if statement must be inside brackets. It should be if (hasPen || hasPencil) {
Question 5
A let isRaining = True;
B let isCold = false;
C if (isRaining || isCold) {
D console.log("Take a jacket");
E }
Line A — Boolean values are written in lowercase in JavaScript. True causes an error, so it should be true.

Student with a class code? Join your class →