The while loop

A while loop executes its body whilst its condition is truthy.

while some_condition {
    # Do something.

The condition is first tested and if truthy the body is executed. Note that it’s therefore possible that the body never executes.

Checking the condition at the end of a loop

If you need to execute the body at least once and then check for a breaking condition, you can do this:

while True {
    # Do something.
    break if some_condition