.. _return-outside-function:

return-outside-function / E0104
===============================

**Message emitted:**

Return outside function

**Description:**

*Used when a "return" statement is found outside a function or method.*

**Problematic code:**

.. literalinclude:: /data/messages/r/return-outside-function/bad.py
   :language: python

**Correct code:**

.. literalinclude:: /data/messages/r/return-outside-function/good.py
   :language: python



Created by the `basic <https://github.com/PyCQA/pylint/blob/main/pylint/checkers/base/basic_error_checker.py>`__ checker.