.. _yield-outside-function:

yield-outside-function / E0105
==============================

**Message emitted:**

Yield outside function

**Description:**

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

**Problematic code:**

.. literalinclude:: /data/messages/y/yield-outside-function/bad.py
   :language: python

**Correct code:**

.. literalinclude:: /data/messages/y/yield-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.