DELVAR Procedure

Deletes variables and their symbols from $MAIN$, the main program level of PV‑WAVE.

Usage

    DELVAR, var1, ... ,varn

Input Parameters

vari — One or more named variables to be deleted.

Keywords

All — If specified, deletes all variables and their symbols on main program level.

Discussion

DELVAR may be called from any program level to delete a variable from the main program level. If DELVAR is called from the main program level, the variable is directly deleted.

When DELVAR is used to delete a local variable, the variable is also deleted from the main program level. If DELVAR is called from a procedure, one of the two following requirements applies:

  • UPVAR must be used to bind the local variable on the procedure level to the variable on the main program level.

  • The variable on the main program level must be passed as a parameter to the procedure or function from which DELVAR is called.

Example

This example creates three variables of differing type and structure, then deletes them using DELVAR.

; Create a single-precision, floating-point vector.
a = FINDGEN(3)
; Create an anonymous structure.
b = {structb, field1:1.0, field2:[5, 6, 7], field3:'PV-WAVE'}
; Create a longword scalar.
c = 6L
INFO, a, b, c
; PV-WAVE prints the following:
;   A FLOAT = Array(3)
;   B STRUCT = -> STRUCTB Array(1)
;   C LONG = 6
; Delete variables a and c.
DELVAR, a, c
INFO, a, b, c
; PV-WAVE prints the following:
;   A UNDEFINED = <Undefined>
;   B STRUCT = -> STRUCTB Array(1)
;   C UNDEFINED = <Undefined>
; Delete variable b.
DELVAR, b
INFO, a, b, c
; PV-WAVE prints the following:
;   A UNDEFINED = <Undefined>
;   B UNDEFINED = <Undefined>
;   C UNDEFINED = <Undefined>

See Also

DELFUNC,  DELPROC,  DELSTRUCT

For more information on releasing memory to the operating system, see the PV‑WAVE Programmer’s Guide.