[<<Previous Entry]
[^^Up^^]
[Next Entry>>]
[Menu]
[About The Guide]
+---------------------------------+
| PUBLIC |
+---------------------------------+
PUBLIC <memvar list>
PUBLIC [ARRAY] <array1> (<expN1>
[, <expN2>]) [, <array2>
(<expN3> [, <expN4>])] ...
-----------------------------------
Defines global memory variable or array.
-----------------------------------
PUBLIC creates memory variables or arrays as global variables or global
arrays. PUBLIC variables and arrays can be accessed and modified from
any program that you execute during the current FoxPro session.
Memory variables and arrays that are created with PUBLIC are initialized
false (.F.) except for the PUBLIC variables FOX and FOXPRO, which are
initialized true (.T.). The PUBLIC variables FOX and FOXPRO can be used
to conditionally execute code based on the product you are running.
Any memory variable or array created in the Command window is
automatically public.
Any memory variables or arrays you wish to declare as PUBLIC must be
declared PUBLIC prior to assigning them a value.
. If within a program you assign a value to a memory variable or array
and later declare it PUBLIC, a syntax error will be generated.
Clauses
-------
<memvar list>
One or more memory variables to be designated as global.
[ARRAY] <array1> (<expN1>
[, <expN2>) [, <array2> (<expN3> [, <expN4>]) ...
One or more arrays to be designated as global. <expN1> is the number
of elements in a one-dimensional array.
(<expN1>, <expN2>) are the number of rows and columns respectively in a
two-dimensional array.
+---------------------------------+
| Program Example |
+---------------------------------+
SET TALK OFF
PUBLIC val1,val2
val1 = 10
val2 = 15
DO down
? val1
? val2
RELEASE ALL && Releases private variables only
DISPLAY MEMORY LIKE val?
RELEASE val1,val2 && Public variables must be released explicitly
DISPLAY MEMORY LIKE val?
PROCEDURE down
PRIVATE val1
val1 = 50
val2 = 100
? val1
? val2
RETURN
-----------------------------------
See Also: DECLARE, DIMENSION, PRIVATE, PARAMETERS, PARAMETERS(),
RELEASE
-----------------------------------
See Also:
DECLARE
DIMENSION
PRIVATE
PARAMETERS
PARAMETERS()
This page created by ng2html v1.05, the Norton guide to HTML conversion utility.
Written by Dave Pearson