Initializes a local memory variable or array
LOCAL <xVar> [:= <xInit> ]
<xVar> Name of a memory variable or array.
<xInit> Value to be assinged to a variable or array
This command created a LOCAL memory variable or array. The name of either is specified in <xVar>. If more then one variable is being initialized with the LOCAL command, separate each entry with a comma. If a variable or an array is to be assingned a start-up value, that expression may be specified in <xInit> and folling. Is Strong type compile mode is used, the Compiler will check if the value recived matchs the type specified in <xType>.
LOCAL varibles are symbols generated at run time and are resolved at compile time. The visibility and life span of a LOCAL variable or array is limited to the function or procedure in which it is defined.
No macro expansions are allowed in the LOCAL declaration statement.
No Harbour command other then FUNCTION, PROCEDURE, PUBLIC, PRIVATE, PARAMETERS, MEMVAR, STATIC and FIELD, may precede the LOCAL command.
LOCAL array reference may not be initialized (i.e., assigned values) on the same command line as the LOCAL command statement. This can be done later in the program.
LOCAL variables and arrays are not affected by the RELEASE command.
PROCEDURE Main() LOCAL n, lVar n := iif( lVar, "A", 3 ) n := 2 n := "a" n := seconds() + 2 n := int( seconds() + 2 ) RETURN
See tests/testwarn.prg for more examples
FIELD, PRIVATE, PUBLIC, STATIC, MEMVAR