Flow Control

Flow control is all about decisions which send the flow of your program in some or other direction. Some well know constructs are if, while and for.

if

x=5

if x==1:
  print "x is 1"
else:
  print "x is not 1"

while

counter=0
while counter < 3:
  print str(counter)
  counter += 1

for

for x in xrange(3):
  print str(x)