pythonreference.com

search statements, functions, methods, exceptions*

show categories

'while' statement
execute block repeatedly until test is False (or 'break' is encountered)
var = 0
while var < 3:
    var = var + 1
    print(var)
initialize int while int is less than 3: increment int print int
1) if the test in this statement is True, enter the block (while True is True) 2) when the end of the block is reached, return to the top of the block and evaluate the test in this statement again (see above -- while True is always True) 3) if a break statement is reached, drop to the first line after the block 4) if a continue statement is reached, return to the top of the block and evaluate the test in this statement again (see above -- while True is always True)