Concept
The else Clause
`else` is your fallback. It executes exclusively when the `if` condition evaluates to `False`:
python
logged_in = False
if logged_in:
print("Welcome")
else:
print("Access Denied")
# 45. The else Clause `else` is your fallback. It executes exclusively when the `if` condition evaluates to `False`: ```python logged_in = False if logged_in: print("Welcome") else: print("Access Denied") ``` `else` takes zero conditions. It just catches whatever fell through.
Checkpoint
Can you attach a condition to `else` like `else score > 50:`?
Practice
Write an `if/else` block checking if `coins >= 10` for `coins = 3`. If false, print `"Too broke"`.
01
Tap code blocks below to assemble
Available Blocks