IsDefined

Determines if a variable name is currently defined.

Syntax:

IsDefined (var)

Parameters:

(s/a) var a variable name.

Returns:

(i) @YES if the variable is currently defined; @NO if it was never defined or has been dropped.; -1 if the specified name is a function name or other reserved word.

 

A variable is defined the first time it appears to the left of an equal sign in a statement. It stays defined until it is explicitly dropped with the Drop function, or until the current invocation of the WIL Interpreter gets closed.

Generally speaking: in batch file-based implementations of WIL, all variables are dropped automatically at the end of every batch file; and in menu-based implementations of WIL, variables stay defined until explicitly dropped.

IsDefined can accept an array name as a parameter.

Example:


If IsDefined(thisvar)
   Message("Value of thisvar is", thisvar)
Else
   Message("ERROR!", "Variable not defined")
EndIf
See Also:

VarType, Drop