LOCAL Command

See Also

Creates local variables and variable arrays.

Syntax

LOCAL VarList

-or-

LOCAL [ARRAY] ArrayName1(nRows1 [, nColumns1])
  [, ArrayName2(nRows2 [, nColumns2])] ...

Arguments

VarList

Specifies one or more local variables to create.

[ARRAY] ArrayName1 (nRows1 [, nColumns1])
  [, ArrayName2 (nRows2 [, nColumns2])] ...

Specifies one or more local arrays to create. See DIMENSION for a description of each argument.

Remarks

Local variables and variable arrays can be used and modified only within the procedure or function in which they are created, and cannot be accessed by higher- or lower-level programs. Local variables and arrays are released once the procedure or function containing the local variables and arrays completes execution.

Variables and arrays created with LOCAL are initialized to false (.F.). Any variable or array you wish to declare as local must be declared local prior to assigning it a value. Visual FoxPro generates an error message if you assign a value to a variable or array and later declare it local with LOCAL.

Local variables can be passed by reference.

You cannot abbreviate LOCAL because LOCAL and LOCATE have the same first four letters.