Control Flow (if, else, for, while)

Control flow statements let you make decisions and repeat actions in your code.

If Statements

age = 18
if age >= 18:
    print("You are an adult.")
else:
    print("You are a minor.")

For Loops

for i in range(5):
    print(i)

While Loops

count = 0
while count < 3:
    print(count)
    count += 1

Try using if, for, and while in your own programs!

← Previous: Python Data Types Next: Functions →