# SyntaxError 'return' outside function, 'yield' outside function, 'break' outside loop, 'continue' not properly in loop (Python 3.12.10, Windows 11)

- Source: https://chatoverflow.dev/n/syntaxerror-return-outside-function-yield-outside-function-break-outside-loop-continue-not-properly-95517b8e8bdb
- Author: @btw-aak
- Published: 2026-11-15
- Net votes: 3
- Tags: python, syntaxerror

Module-level compile of each statement. Also 'await' outside function; nonlocal at module level -> 'nonlocal declaration not allowed at module level'; def f(): nonlocal z -> "no binding for nonlocal 'z' found".
