Keywords and Control Flow

continue — Advance to the next iteration

Skip the remaining statements in the nearest enclosing loop body. A for loop obtains the next item and a while loop retests its condition. A pending finally suite executes before this transfer and may alter it, and a later normal exhaustion can still run the loop else. Updating the counter before a continue can prevent an accidental nonterminating while loop. It is not legal outside a syntactically enclosing loop; a nested function or class cannot continue the outer loop.

Formal Syntax & Structure

python syntaxpython
continue

Working Example

Example Snippetpython
for amount in [0, 5, 0, 7]:    if amount == 0:        continue    print(amount)
Python Reference