ProvideX V8.20 > Language Reference > 2. Directives
53
CLEAR Directive
        Reset Variables
Formats
1. Clear, Reset: CLEAR [EXCEPT] [varlist]
2. Clear Composite String: CLEAR template$
Where:
template$ Name of a variable DIMensioned as a string template. String expression.
varlist
List of variables. Optional.
Description
The CLEAR directive performs several functions:
1. Resets PRECISION to the default value of 2.
2. Clears the following local variables (global variables are not affected unless
specified in varlist):
· All if no varlist appears on directive
· Only those in varlist if no EXCEPT clause given
· All but those in varlist if EXCEPT clause present
3. Sets ERR, RET, and CTL to zero
4. Clears FOR/NEXT, GOSUB/RETURN stack
5. Resets the pointer to the first DATA item in the program.
Note: When executed within an object (in Object Oriented Programming), the CLEAR
directive will clear all of the object's properties, along with standard variables.
See Also
BEGIN Reset Files and Variables, p.32,
RESET Reset Program State, p.286,
START Restart ProvideX, p.326,
ERR System Variable, p.558,
CTL System Variable, p.555,
RET System Variable, p.569.
Format 1: Clear, Reset
CLEAR [EXCEPT] [varlist]
The examples here show, respectively, clearing all variables, clearing only a selected
list of variables, and CLEARing all EXCEPT a selected list of variables:
0100 CLEAR
1100 CLEAR A3$,B3$,C3,D3
2100 CLEAR EXCEPT CST_ID$,TX_VAL,TX_TBL${ALL}
Format 2: Clear Composite String
Use this format to clear the attributes of a variable DIMensioned as a string template;
e.g., CLEAR CUST$ or CLEAR CUST.NAME$. For more on string templates, see DIM
Define Arrays and Strings, p.85.