Glossary Updates12 new terms added to the glossaries · October 2, 2026, 22:44 CEST
AI TechDocKnowledge

Glossary · PLC and control programming

Variable declaration

Also known as: Declaration section, VAR block

German: Variablendeklaration

In IEC 61131-3 programming, a variable declaration defines a variable's name, data type, optional initial value and qualifiers, within a section such as VAR, VAR_INPUT, VAR_OUTPUT, VAR_IN_OUT, VAR_GLOBAL or VAR_TEMP that determines its scope and role.

  • PLC programming
  • Standards

In one sentence

A variable declaration sets a PLC variable's name, data type, initial value and scope, for example in VAR_INPUT or VAR_GLOBAL.

Example

The declaration VAR_INPUT rSetpoint : REAL := 20.0; END_VAR defines an input with default 20.0 for a temperature control block.

How it applies

  • Engineering: Declarations define the interface and internal data of every program unit. The section keyword determines scope: inputs, outputs and in-out parameters form the external interface; VAR and VAR_TEMP are internal; VAR_GLOBAL and VAR_EXTERNAL share data. Qualifiers such as RETAIN and CONSTANT add behavior.
  • Quality: Naming conventions (prefixes for type or scope), meaningful initial values and comments at the declaration make code readable. Static analysis tools can check them.
  • Maintenance: Changing declarations, especially of interfaces and retentive data, can affect online changes and data initialization.
  • Documentation: Comments at declarations are often extracted into generated documentation. Write them for readers outside the programming team: what the value means, its unit and its valid range.

Declaration vs. definition of a type

A variable declaration creates a variable of a type. A type definition (TYPE … END_TYPE) creates a new data type, such as a User-defined data type (UDT), which declarations can then use.

By knowledge.aitechdoc.world · Published September 26, 2026 · Last reviewed

Source: IEC 61131-3, Programmable controllers — Part 3: Programming languages

Definitions follow the cited standards and specifications. Where a source is a copyrighted publication, such as an ISO, IEC or EN standard, the definition is a close paraphrase, not a verbatim quotation, so as not to infringe copyright. We recommend reading the original publication. The sections “How it applies” are editorial commentary by AI TechDoc Blog and are not part of any standard.

Seen a mistake? Send us a note!