This is an archived version of the course. Please find the latest version of the course on the main webpage.

Chapter 4: for loops

continue

face Josiah Wang

If you noticed, I used break in one of the questions earlier to break out of a for loop. Hopefully you are familiar with break by now!

Here is another statement that can be used to alter the flow of a loop. It is called continue. It immediately jumps to the beginning of the loop without executing the remaining statements in the loop.

"Continue vs. break vs. pass"

Just imagine your favourite panel on an audition interrupting you saying “Thank you! Next!” when he/she has seen or heard enough! That’s the main idea behind continue.

You can use continue with while and for loops, but it makes more natural sense with for loops.