UNSET Values and UNDEFINED Variables
- Last UpdatedOct 29, 2024
- 1 minute read
All data types can have the value UNSET which indicates that a variable does not have a value. A variable created without giving it an initial value in fact has the value UNSET:
!X = REAL()
Variables with an UNSET value can be passed around and assigned, but use of an UNSET value where a valid item of data is required will always result in a PML error.
The presence of an UNSET value may be tested either with functions or methods:
|
Functions |
Methods |
|
if ( Unset(!X) ) then |
if ( !X.Unset() ) then |
|
if ( Set(!X) ) then |
if ( !X.Set() ) then |
An UNDEFINED variable is one that does not exist. The existence of a variable may be tested with these functions:
if ( Undefined(!!Y) ) then . . .
if ( Defined(!!Y) ) then
There is no equivalent method call. If the variable does not exist, attempting to call a method would result in an error.