Video 7: Looping (page 4 of 5) |
We can use the break keyword to break out of a while loop.
The break statement ends the current loop and jumps to the statement immediately following the loop at the same level of indentation as the while keyword.
The continue keyword ends the current iteration and jumps to the top of the loop and starts the next iteration. We can use this keyword to control which statements get executed based on the value of the iteration variable.