The else Statement
Right on — Step 2 time, and we’re turning the energy dial all the way up.
This is the moment your game learns how to say, “Nope. Not happening.”
Let’s go.
Welcome back, coder.
In Step 1, your game learned how to make a decision with if.
But here’s the problem:
What happens when the answer is NO?
Your game can’t just stare into the void like,
“Well… now what?”
That’s where else comes in.
1. What Is else?
else is your game’s backup plan.
It runs when the if condition is NOT true.
Think of it like:
- “If you have enough coins, buy the sword.”
- “Else… go cry in the corner.”
Your game now has OPTIONS.
2. Basic Structure
if condition:
# do this
else:
# do this instead
It’s like giving your code two possible destinies.
Very dramatic. We love it.
3. Example: Shopping Logic
coins = 5
if coins >= 10:
print("You buy the sword!")
else:
print("You don't have enough coins...")
Your game now handles poverty with grace.
4. Example: Health Check
health = 80
if health < 30:
print("Warning! Health is low!")
else:
print("You’re doing fine. Keep going!")
Your game now gives motivational speeches.
Practice (Your Turn!)
Mini Challenge
If energy is greater than 0, print:
"You keep running!"
Else print:
"You collapse dramatically!"
Boom.
Your game now reacts to exhaustion like a true drama queen.


