Python continue Statement
Syntax
The continue statement in Python is used to skip the rest of the code inside a loop for the current iteration and jump to the next iteration.
# Using continue in a loopfor number in range(1, 6): if number == 3: continue # Skip the rest of the loop for this iteration print(number)Example
# Skipping even numbers in a loopfor i in range(1, 6): if i == 3: continue # Skip even numbers print(i)
# Output:# 1# 2# 4# 5