ID : 471
Valid Range of Local Variable (Scope)
Valid Range at The Block Described (Scope)
Local variables declared in the procedure are valid only in the procedure.
Local variables declared outside of the procedure is valid in the task (program file).
The same local variable cannot be declared in the range, however a declaration in the task and a declaration in the procedure can be overlapped. When overlapped, a local variable declared in the procedure (narrow valid range) is prioritized.
Valid Range at The Point Described
Program is processed from the upper lines to down. Local variable cannot be accessed at the upper line of the declaration of the local variable.
Source code loaded by #Include is expanded on the line. So, take care of the position where you declare the variable in the source code loaded.
Related Terms
ID : 471