If / Else: Make Decisions! 🔀
Your code can think! It asks a question — and does different things based on the answer. Just like you do every day!
umbrella!
sunglasses!
Code Can Make Smart Decisions!
No more doing the same thing every time — your code chooses!
When I first learned about if/else, my teacher used a choose-your-own-adventure book as an example. You reach a fork in the road — turn left or right? Your code does the same thing. It checks a condition and picks a path. That’s all there is to it! 😊
Go to page 15.
You find treasure! 💎
Go to page 23.
You walk away safely! 🚶
You Do This Every Day!
If/else thinking is everywhere — you just never noticed!
Going Outside
IF it’s raining THEN bring umbrella ☂️ ELSE wear sunglasses 😎Feeling Hungry
IF I’m hungry THEN eat a snack 🍎 ELSE keep playing 🎮Traffic Light
IF light is green THEN walk across 🚶 ELSE wait patiently ✋Bedtime
IF it’s 10pm THEN go to sleep 💤 ELSE keep having fun 🎉Interactive Decision Maker!
Move the sliders — watch the if/else decide what to do!
Adjust temperature and sunshine — see what your code decides!
3 Ways to Write Decisions
Each one handles a different situation!
Just IF — One Decision
When you only need to check one thing. If it’s true — do it. If not — do nothing at all.
I use this when I want my game to only do something when the player scores! 🎮
score = 100
if score >= 100:
print("🏆 You win!")IF / ELSE — Two Paths
When there are two possible outcomes. One thing happens if true — something else if false!
Like a coin toss — heads or tails. Always one of the two! 🪙
if raining == True:
print("☂️ Take umbrella!")
else:
print("😎 Wear sunglasses!")IF / ELIF / ELSE — Many Choices
When you have more than two options! Check the first, then the second, then the third…
Like a grade checker — A, B, C, or D. More than two options! 📊
if score >= 90:
print("⭐ Amazing! A+")
elif score >= 70:
print("👍 Good job! B")
else:
print("💪 Keep going!")6 Symbols You Need to Know
These symbols help your code ask yes/no questions!
4 questions · pick an answer to check!
⭐ Remember This!
IF asks a yes/no question in your code
ELSE is what happens when the answer is NO
ELIF lets you check even more options
If/else makes your code smart and dynamic!
