Keywords and Control Flow
break — Exit the nearest loop
Leave the innermost enclosing for or while loop, without running its else clause. It does not leave an enclosing function or all nested loops at once. A pending finally suite executes on the way out and may alter the control transfer. A break outside a permitted enclosing loop is a syntax error, including inside a function defined within a loop.
Formal Syntax & Structure
python syntaxpython
breakWorking Example
Example Snippetpython
for row in [1, 2]: for value in [3, 4]: print(row, value) breakprint("done")