The while Loop

The while control structure works just like the while statement in C. While executes a block of code repeatedly, as long as the test condition is true:

while test_condition: code

An example of the while loop is shown below.

# for example...

while x < 10: {
        print "x = $x".
        x++.
}