Conditionals & Logic
📋 What it is
A conditional (if-then-else) lets a program make a decision, doing different things based on a test.
🗣️ Coach says
Programs make choices with IF-THEN-ELSE: "IF it's raining, take an umbrella, ELSE wear sunglasses." The computer checks a condition (true or false) and picks a path. Conditionals are how code reacts to different situations instead of doing the exact same thing every time.
🧠 Memory hook
IF a test is true, do this; ELSE do that. That's how code decides.
😂 Giggle
Why did the programmer quit his job?
Because he didn't get arrays! (a raise!)
😲 Whoa!
Every choice your favourite game makes — did you hit the target? did you level up? — is really just a stack of if-then decisions running very fast.
✅ Quick check: What does an if-then-else conditional let a program do?
Say your answer out loud first — then reveal.
Make a decision — check a condition and do different things depending on whether it's true or false.
Conditionals branch the program based on a true/false test.
🧪 Try it! (2 minutes)
Write an if-then-else in plain words for getting dressed: "IF it's cold, wear a coat, ELSE wear a t-shirt."