→Retentive and non-retentive variable: RETAIN, NON_RETAIN

Retentive variables are variables that are stored in a way that their values are conserved without changes for a →warm restart after the application has been stopped. Non-retentive variables are initialized anew with their →initial value, in case of a warm restart.

Declaration ofin ST-editor, by using a keywordin a graphical editor, by using a prefix
(e.g. within the FBD-editor when creating a value field with a new variable)
retentive →variablesRETAINR
non-retentive variables
NON_RETAINNR

The keywords are only allowed for the sections VARVAR_INPUTVAR_OUTPUT and VAR_GLOBAL but also for declared →function block instances. They are not allowed for program instances within the PLC-object.
The prefix is only allowed for internal variables, →input variables→output variables and →global variables.