continue

KeywordPython 2.0+Beginner

Skips the rest of the current loop iteration and moves to the next

Quick Info

Documentation
Official Docs
Python Version
2.0+

Learn by Difficulty

Quick Example

python
# Print only odd numbers
for i in range(10):
    if i % 2 == 0:
        continue
    print(i, end=" ")
print()

# Skip blank lines
lines = ["hello", "", "world", "", "python"]
for line in lines:
    if not line:
        continue
    print(line)

continue skips the rest of the current iteration and jumps to the next one. The loop itself keeps running.

Try in Playground

Tags

languagesyntaxcorecontrol-flowloop

Related Items