You may have noticed that a
while loop checks the loop condition before each iteration of the code inside. A logical alternative is to check the condition after each iteration before looping back. A
while loop does just that. One consequence of this difference is that the code inside a
while loop can be bypassed entirely whereas the code inside a
while loop will execute at least once.
This means that the loop condition can depend exclusively on code within the loop's body. This is the case for the code in the editor where each iteration represents a coin flip, and any time the result of the coin flip is tails, the loop stops.