检测某个变量是否已声明.
IsDeclared ( 表达式 )
表达式 | 目标变量/表达式. |
成功: | 返回值为1,说明该变量为全局变量或在函数外部声明的变量. |
特殊: | -1,说明该变量为局部变量. |
失败: | 返回值为0,说明未发现目标变量. |
If Not IsDeclared("a") Then
MsgBox(0, "", "$a is NOT declared") ; $a has never been assigned
EndIf
Local $a = 1
If IsDeclared("a") Then
MsgBox(0, "", "$a IS declared") ; due to previous $a=1 assignment
EndIf