Skip to content

If Statement (if)

Use for the scenario that has one decision-making only.

Usage

if meet_condition:
    do action
  • The condition must return Boolean value.

Example

if.py

py
age = 30

if (age >= 18):
    print("You are eligible to play this game")

Results:

You are eligible to play this game