Learn Before
Code
Continue Statement
The continue statement is used to ignore specific iterations of a loop and go onto the next iteration instead. Once the statement is reached and its conditions are met, control jumps back to the top of the loop, ignoring any remaining code in the loop body. In this example, the number 3 won't be printed.
x = 0 while x < 5: x = x + 1 if x == 3: continue print(f"{x}")
Continue statements work similarly to break statements, but they only end a single iteration of the loop, not the entire loop itself.
0
1
Updated 2021-07-21
Tags
Python Programming Language
Data Science