Local Variables

Variables declared within a Procedure or Function are called Local variables. A local variable's scope is only inside the Procedure or Function in which it is declared. A variable declaration is deemed to be within a Procedure or Function if the declaration occurs between a Procedure .. End_Procedure or Function .. End_Function command pair. Examples of local variable declarations are:

Procedure DoNothing

    Integer iNew

    String  sTest

    …

    // code exists here that uses the local variables

End_Procedure

// Code outside the procedure cannot access the local variables

The point of local variables is that they cannot be accessed or changed outside of the procedure or function in which they are declared. This means that they can be used inside the procedure with the assurance that no code outside the procedure can corrupt its value.

See Also

Declaring Variables

Global Variables

Data Types, Variables and Constants