All lessons

If / Else Decisions

See how a program picks a different path depending on a condition

Change x with − and +. Watch which branch lights up and what the program prints.

x =5
x = 5
if x >= 10:
print("pass")
else:
print("fail")

x >= 10condition is FALSE · else runs

Output

fail