.. _Declare Variable:

Declare Variable
================

An error is triggered when using an identifier which does not exist, for example a variable which you did not declare yet.

.. figure:: ../../images/common/e_quick_fix_declare_variable_list.png
	:align: center




Place the editor cursor on the error's line and press :kbd:`Ctrl+1`, select **Declare variable ...** from the list of quick fix proposals and press :kbd:`Enter`.

.. figure:: ../../images/common/e_quick_fix_declare_variable_after.png
	:align: center




.. note::

	The type of the new variable declaration is automatically detected from context.

.. note::

	When the same undeclared identifier is used across multiple scopes, the variable declaration is placed in such a way that it is visible for all usages.

.. note::

	Depending on context, several quick fix proposals might be available:

	-  declare variable
	-  declare argument (if inside a method)
	-  declare field (if inside a struct)

.. tip::

	You may change the variable type. Press :kbd:`Enter` when done.

