Nested If

You can have if statements inside if statements, this is called nested if statements.

Example

x = 41


if x > 10:

 print("Above ten,")

 if x > 20:

   print("and also above 20!")

 else:

   print("but not above 20.")

The pass Statement

if statements cannot be empty, but if you for some reason have an if statement with no content, put in the pass statement to avoid getting an error.

Example

a = 33

b = 200


if b > a:

 pass

Jay Kakadiya

Jay Kakadiya Creator

I am a computer field, & i am Web developer.

Suggested Creators

Jay Kakadiya