Title: Layout 2
Course: CPS 120: Introduction to Computer Science ~ Master (Aug/2015) OLD > Section: Learning Units

✓ Layout 2 syntax – test whether to execute one block or another

if <condition>:
<block>
else:
<block>

✓ Layout 2 examples:

if number >= 0:
print ("Number is nonnegative.")
else:
print ("Number is negative.")

if x == 100:
print("x is 100")
else:
print("x is not 100")