User`s guide

Automatic variables are more like the local variables of other high-level languages. If you are
writing programs using a recursive algorithm, you will most likely want to use variables in the
automatic class.
Scope of Variables
The scope of a variable refers to the range of programs that can see that variable. The
following figureshows the scope of the different variable classes. A variable can be altered by
the program(s) indicated in the shaded area of the box it is in plus any programs that are in
smaller boxes. When a program declares an AUTO or LOCAL variable, any GLOBAL variables of
the same name created in other programs are not accessible.
Variable Scoping
Variable Scope Example shows an example of using the various variable classes. Notice that:
l prog_1 declares a to be GLOBAL. Thus, it is available to all programs not having an
AUTO or LOCAL a.
l prog_2 creates an undeclared variable b. By default, b is GLOBAL and available to other
Variable Classes
V+Language User's Guide, v17.0
Page 108