.. _global-variable-not-assigned:

global-variable-not-assigned / W0602
====================================

**Message emitted:**

Using global for %r but no assignment is done

**Description:**

*Used when a variable is defined through the "global" statement but no assignment to this variable is done.*

**Problematic code:**

.. literalinclude:: /data/messages/g/global-variable-not-assigned/bad.py
   :language: python

**Correct code:**

.. literalinclude:: /data/messages/g/global-variable-not-assigned/good.py
   :language: python



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