Day 11: Boolean Operators
Monday, March 30th, 2026
Warmup: Review — Conditionals
Last week we used if blocks to make decisions in our programs. For example, we checked if a sprite was touching a wall color.
An if block checks a single condition — something that is either true or false. But what if you need to check more than one thing at the same time?
That’s where boolean operators come in.
| Operator | What it does |
|---|---|
and | true only when both conditions are true |
or | true when at least one condition is true |
not | Flips a condition — true becomes false, false becomes true |
Example
Look at this program:
when green flag clicked set [level v] to (4) set [power v] to (55) if <<(power) > (50)> and <(level) > (3)>> then cast_firebolt end
Will cast_firebolt run?
power > 50→55 > 50→ truelevel > 3→4 > 3→ truetrue and true→ true
Yes — both conditions are true, so the and block is true and cast_firebolt runs.
What if power was 30?
power > 50→30 > 50→ falselevel > 3→4 > 3→ truefalse and true→ false
No — with and, both sides must be true.
Work Session: Boolean Operators in Scratch
Where to Find Boolean Operators
In Scratch, the and, or, and not blocks are green and live in the Operators category. They are shaped like pointed ovals, which means they fit inside the diamond-shaped slots of if blocks.
Part 1: and
The and block is true only when both conditions are true. Use it when two things must happen at the same time.
when green flag clicked forever if <<key [space v] pressed?> and <touching [ground v]?>> then change y by (100) end end
This code only lets the player jump when they are pressing space and touching the ground. Without and, the player could jump in midair.
Part 2: or
The or block is true when at least one condition is true. Use it when either thing should trigger the result.
when green flag clicked forever if <<touching [lava v]?> or <touching [spikes v]?>> then go to x: (-200) y: (0) end end
This resets the player if they touch lava or spikes. You don’t need two separate if blocks.
Part 3: not
The not block flips a condition. Use it when you want something to happen only when a condition is false.
when green flag clicked forever if <not <key [space v] pressed?>> then change y by (-5) end end
This makes the player fall when they are not pressing space. We’ll use this idea later this week when we build a gravity system.
Try It
Open Scratch and build a small project that uses at least one boolean operator. Here are some ideas:
- A sprite that only moves when two keys are pressed at the same time (
and) - A sprite that changes color when touching one of two different sprites (
or) - A sprite that falls when it is
nottouching the ground
Work Session 2: Learning Check
Complete the Boolean Operators Learning Check on CTLS. You will look at Scratch programs and predict whether conditions are true or false.
Here’s some practice questions while you wait.
Closing
Today you learned three boolean operators that let you combine conditions:
and— both must be trueor— at least one must be truenot— flips true to false
Later this week, we’ll use these operators to build a gravity system for a platformer game. The not operator will be especially important — we’ll use it to make a sprite fall when it is not touching the ground.
Standards
- MS-CS-FCP.3.2 — Develop a working vocabulary of computational thinking including Boolean, branches (if…then…else), and iteration.
- MS-CS-FCP.4.5 — Implement a simple algorithm in a computer program.
- MS-CS-FCP.4.9 — Develop a program that makes a decision based on data or user input.