✦
✦
Computer Science · Coding Basics
Conditionals: Making Decisions
Computers can't think for themselves — but they can follow rules! A conditional checks IF something is true, then decides what to do next.
🍴A Fork in the Road
🎮Read the Code: a Lava Game
game.code
# Every video game uses conditionals!
IF player touches lava:
lose a life 💔
ELSE:
keep running 🏃
🔢True or False? (Boolean Logic)
TRUE ✔
the condition is met — go!
FALSE ✘
not met — no "maybe" allowed!
AND
TRUE only when BOTH are true.
green light AND no cars
OR
TRUE if at least one is true.
snack OR juice
NOT
Flips it — true becomes false.
NOT raining = sunny
🚦You Use Conditionals Too!
🧠 Your brain runs this at every crosswalk:
✔IF the light is green → WALK 🚶
✘ELSE → WAIT at the curb 🛑
🔑Key Terms
🔀Conditional Code that branches based on a true/false test.
⚖️Boolean A value that is only TRUE or FALSE.
✅IF Statement Code that runs only when a condition is TRUE.
↩️ELSE Statement Code that runs when the IF condition is FALSE.
➗Comparison Operator A symbol that compares values: < > == != ≤ ≥.
🔗AND · OR · NOT Logic words that combine or flip true/false tests.
⭐
Remember: without conditionals, programs could never react to what you do — every IF gives the computer a choice!