Knowledge organisersSelection
IF statements inside IF statements.
A nested if is an if statement inside another if statement. Use this when a second decision depends on the first. Indentation shows which if each else belongs to.
has_ticket = True
age = 14
if has_ticket:
if age >= 18:
print("Adult entry")
else:
print("Child entry")
else:
print("Buy a ticket first")