Difference between revisions of "LOCAL"
Yvonnemilne (Talk | contribs) |
Yvonnemilne (Talk | contribs) |
||
Line 8: | Line 8: | ||
==See Also== | ==See Also== | ||
− | [[DECLARE]], [[DIMENSION]], [[DISPLAY MEMORY]], [[DO]], [[FUNCTION]], [[PRIVATE]], [[PROCEDURE]], [[PUBLIC]], [[RELEASE]], [[RESTORE]], [[SAVE]], [[SET CLIPPER]], [[STORE]] | + | [[DECLARE]], [[DIMENSION]], [[DISPLAY MEMORY]], [[DO]], [[FUNCTION]], [[PRIVATE]], [[PROCEDURE]], [[PUBLIC]], [[RELEASE]], [[RESTORE]], [[SAVE]], [[SET CLIPPER]], [[SET STRICT]], [[STORE]] |
Line 17: | Line 17: | ||
Memory variables and arrays declared with the optional AS <datatype> clause are subject to data type checking when a value is assigned. An attempt to assign a value of an incompatible data type will fail and return error 306. The following <datatype> values can be specified: | Memory variables and arrays declared with the optional AS <datatype> clause are subject to data type checking when a value is assigned. An attempt to assign a value of an incompatible data type will fail and return error 306. The following <datatype> values can be specified: | ||
+ | |||
* ARRAY | * ARRAY | ||
Line 27: | Line 28: | ||
* NUMERIC | * NUMERIC | ||
* OBJECT | * OBJECT | ||
+ | |||
LOCAL variables differ from PRIVATE variables in that a LOCAL variable is not visible to lower level procedures or functions. | LOCAL variables differ from PRIVATE variables in that a LOCAL variable is not visible to lower level procedures or functions. |
Revision as of 14:19, 12 November 2009
Purpose
Declare a memory variable or array local to the current procedure
Syntax
LOCAL <variable1> [AS <datatype>] [, <variable2> [AS <datatype>]...]
See Also
DECLARE, DIMENSION, DISPLAY MEMORY, DO, FUNCTION, PRIVATE, PROCEDURE, PUBLIC, RELEASE, RESTORE, SAVE, SET CLIPPER, SET STRICT, STORE
Description
The LOCAL command declares memory variables or arrays to be local to a procedure, function or program. When the procedure, function or program returns, then all of the memory variables and arrays that were declared by the LOCAL command are released.
The memory variables are initially declared as logicals with the value .F., unless SET CLIPPER is ON, in which case they are undefined.
Memory variables and arrays declared with the optional AS <datatype> clause are subject to data type checking when a value is assigned. An attempt to assign a value of an incompatible data type will fail and return error 306. The following <datatype> values can be specified:
- ARRAY
- CHARACTER
- CLASSNAME
- CURRENCY
- DATE
- DATETIME
- LOGICAL
- NUMERIC
- OBJECT
LOCAL variables differ from PRIVATE variables in that a LOCAL variable is not visible to lower level procedures or functions.
See DECLARE or DIMENSION for more details on array declaration.
Example
local cTmpbuf ? cTmpbuf .F.
Products
Recital Server, Recital