Export (0) Print
Expand All
Expand Minimize

PRIVATE Command

Hides specified variables or arrays that were defined in a calling program from the current program. There are two versions of the syntax.


PRIVATE VarList

PRIVATE ALL[LIKE Skeleton | EXCEPT Skeleton]

Parameters

VarList

Specifies the variables or arrays to be declared private.

The single letters A through J and M are reserved and cannot be used as variable names.

ALL LIKE Skeleton

Causes PRIVATE to hide all variables and arrays whose names match Skeleton, which can contain the question mark (?) and asterisk (*) wildcards.

ALL EXCEPT Skeleton

Causes PRIVATE to hide all variables or arrays unless their names match Skeleton, which can contain the question mark (?) and asterisk (*) wildcards.

Items within VarList are separated by commas. The hiding of variables created in higher-level programs enables variables of the same name as the private variables to be manipulated in the current program without affecting the values of the hidden variables. Once the program containing PRIVATE has completed execution, all variables and arrays that were declared private are again available.

PRIVATE doesn't create variables; it simply hides variables declared in higher-level programs from the current program.

*** Program example demonstrating PRIVATE ***
SET TALK OFF
val1 = 10
val2 = 15

DO down
? val1, val2  && Displays 10, 100

PROCEDURE down
PRIVATE val1
val1 = 50
val2 = 100
? '   Val1   Val2'
? val1, val2  && Displays 50, 100
RETURN

Community Additions

ADD
Show:
© 2014 Microsoft