Skip to main content

Element: Variable declaration

The Variable declaration element is used to extend a class, interface, or data structure (DUT) by a variable.

User input

Action

Description

  1. In the ToolBox view, select the Variable declaration _uml_icon_tool_variable_declaration.png element.

  2. In the editor, click a suitable element.

    The Declare Variable dialog opens.

  3. Specify a name for the variable declaration.

  4. Click Add to exit the dialog.

The cursor is displayed as a _uml_cursor_not_allowed.png prohibition symbol at locations that are not permitted.

The cursor is a _uml_cursor_allowed.png blue cross at permitted locations.

When you close the dialog, CODESYS adds this variable to the object and displays it in the class diagram and in the Devices view or POUs view.