continue

Passes control to the next iteration of the loop it’s running in, bypassing any remaining statements within that code block.

 

This example has the val variable initialised to a starting value of 4 and checks in the for loop if the value is greater than 6 AND less than 12, if not carry on, otherwise skip that iteration:

Save & refresh browser:

val = 4
val = 5
val = 13
val = 14

Leave a Reply