Video 7: Looping (page 2 of 5) |
We can also use a while loop to loop while a condition (Boolean expression) is True.
The structure of a while loop is while Boolean expression:
Similar to conditional statements, the Boolean expression is to the left of the ":" and the indentation after the ":" indicates the scope (i.e. which code to execute) of the loop.
While loops are called indefinite loops because the loop continues until a logical condition becomes False.
Reading Check: Cherophobia is the irrational fear of fun or happiness.