Declaration of temporary variables in ST

Syntax
VAR_TEMP
  name_1, name_2, ..., name_n  : data-type := initial-value;
  name_3, name_4, ..., name_n  : STRING[length] := 'initial-value';
  name_5, name_6, ..., name_n  : ARRAY [x..y] OF type := [initial-value_1, initial-value_2, .., initial-value_n];
  name_7, name_8, ..., name_n  : ARRAY [x1..y1, x2..y2, x3..y3] OF data-type;   (* Here, initial values are possible as well. *)
  name_9, name_10, ..., name_n : REF_TO type := REF(name_A);
(* Additional pieces of data, such as partial addresses, are also possible for the variables. *)
END_VAR
Meaning

declaration of one or more internal →temporary variables, name_1 etc. must be →IEC-identifiers
The declaration of more sections of this kind is allowed. The declaration is possible within declaration of a →program, of a →function block, of a →function or of a →method.

See "Supported data types" to learn which data types are supported for the declaration of variables. Use the optional →initial value [:= initial-value] to assign a value to the variable (see "Initialization of variables in ST" for details).
Moreover, it is possible to declare:

Temporary variables and local variables (VAR ... END_VAR) are identical in functions and methods. Neuron recommends for functions and methods to declare temporary variables within the section VAR ... END_VAR (instead within section VAR_TEMP ... END_VAR,) .

Good to know

(grey lightbulb)  Moreover, Neuron Power Engineer allows you to define a not yet fully specified location for the declaration. See "Declaration of a language element with partial address in ST" for details.

(grey lightbulb) Moreover, Neuron Power Engineer allows you to specify additional data for the declaration. See "Defining description, comment, JSON string or type for variables or data types" for details.

Example
VAR_TEMP
  temp1: BOOL;
  temp2, temp3 : INT; 
END_VAR
 
VAR_TEMP
  temp4 : STRING[10]; 
  temp5: ARRAY [1..2] of BOOL;
  temp6 : INT;
  myRefTemp1: REF_TO INT;
END_VAR