Back
+10 XP
Concept

The if Statement

The `if` statement checks a condition. If it is `True`, it runs the indented lines beneath it:

python
ammo = 0
if ammo == 0:
    print("Click! Out of ammo!")

# 44. The if Statement The `if` statement checks a condition. If it is `True`, it runs the indented lines beneath it: ```python ammo = 0 if ammo == 0: print("Click! Out of ammo!") ``` If the condition is `False`, Python completely skips the indented lines and continues downward like nothing happened.

Checkpoint

What happens if the condition in an `if` block is `False`?

Practice

Write an `if` statement that checks if `health <= 0` for `health = 0`. If true, print `"Game Over"`.

Terminal
01
Tap code blocks below to assemble
Available Blocks