Truth tables

See example.

Indefinite Loops

While Loops

while <test>:
   #body

See example.

Indefinite Loops

Infinite Loops—if the test is always true, the loop won't terminate. With the interpreter, use a control-C. Here is an example of an infinite loop:

while true: print "hello"

Usually the problem with the test is more subtle. And, at times, infinite loops are useful.

Translating loops:
Definite -> indefinite (yes)
Indefinite -> definite (maybe)

Post-test idiom:

while True:
       ...
       if ...: break
       ...