Chapter 10: Logical Operators (AND, OR, NOT)
Combine multiple conditions cleanly to handle ranges, dual controls (WASD + Arrows), and key-release waits.
Lesson goal & core concept
Build compound rules without messy nested "if" blocks.
AND needs both sides true; OR needs at least one side true; NOT flips true to false and false to true.
Scratch Logic Gate Explorer (AND / OR / NOT)
Toggle Condition A and Condition B to see live true/false results for Scratch AND, OR, and NOT boolean blocks.
Step-by-step practice
Work through these steps in the Scratch editor, predicting each result before clicking the green flag.
- Use OR to accept both Right Arrow and D key.
- Use AND to check both touching Door AND has_key = 1.
- Use NOT inside "wait until <not <key space pressed?>>" to prevent spam jumps.
- Evaluate inner hexagons first when reading nested logic.
- When green flag clicked
- Forever
- If <key (right arrow) pressed? or key (d) pressed?> then
- Change x by 6
Try it: Supports both arrow keys and WASD seamlessly.
Mini challenge & next steps
Create an S-Rank check requiring BOTH score >= 100 AND misses = 0.
FAQ
How long should I spend on "Chapter 10: Logical Operators (AND, OR, NOT)"?
Aim for 15–20 minutes: read the concept, test the small example, modify one value to see what changes, and try the mini challenge.
This guide is provided for educational purposes. Scratch screens and terms may change over time, so please check the official Scratch website as well.