Local, valid throughout subroutine (V.L.)
The code "V.L. ....” permits the definition of self-defined variables which are valid local at the current program level and in directly called subroutines. They are deleted when the program level in which they were created is left (return).
A V.L. variable may be redefined with the same name at a lower program level and assigned a new value. This value is valid until this program level is left (return). The V.L. variable with the same name then has the original value.
V.L. variables may be assigned values in REAL format. As of Build V2.11.2032.08 declarations of other data types with initial values are possible.
V.L. variables can also be created as multi-dimensional arrays. A maximum of 4 dimensions is possible, e.g. V.L.TEST[1][2][3][4].
Syntax: | |
V.P.<FREE_DEF> | local global variable in programs and subroutines |
<FREE_DEF> | User-defined name consisting of any number of characters (excluding blanks, tabulators, comments, comparison operators, mathematical operators, square brackets). |
Programing Example
Local valid after subroutine end (V.L.)
Create V.L. variables with and without assigning data types and initial values.
:
#VAR
V.L.LOC_VAR1 ;REAL64, 0.0
V.L.LOC_VAR2 : UNS32 = 200 ;UNS32, 200
V.L.LOC_VAR3 : REAL64 = 11.34 ;REAL64, 11.34
V.L.LOC_VAR4 : BOOLEAN ;BOOLEAN, FALSE or 0
V.L.LOC_VAR5 = 10 ;REAL64, 10.0
#ENDVAR
:
XV.L.LOC_VAR5 ;X10.0
:
The maximum number of self-defined V.L. variables is fixed [6]-6.23. At the start of the program, all names and values of those V.L. variables are deleted.