Python Language Conditionals If statement


if condition:

The if statements checks the condition. If it evaluates to True, it executes the body of the if statement. If it evaluates to False, it skips the body.

if True:
    print "It is true!"
>> It is true!

if False:
    print "This won't get printed.."

The condition can be any valid expression:

if 2 + 2 == 4:
    print "I know math!"
>> I know math!