Check if a variable has been declared.
IsDeclared ( expression )
|expression||string representing name of the variable to be checked.|
|Success:||Returns 1 for Global variable or variable declared outside functions.|
|Special:||-1 for Local variable.|
|Failure:||Return 0 when no variable can be found.|
RemarksIf there is a need to use IsDeclared() to check that a variable exists, then in most situations Assign() should be used to create/write to the variable and Eval() should be used to read from the variable.
If Not IsDeclared ("a") then
MsgBox(0,"", "$a is NOT declared") ; $a has never been assigned
If IsDeclared ("a") then
MsgBox(0,"", "$a IS declared" ) ; due to previous $a=1 assignment