IsDeclared

From AutoIt Wiki

Jump to: navigation, search

Check if a variable has been declared. Adapted from AutoIt docs.

Contents

Syntax

$chk = IsDeclared(expr)

Parameters

exprString representing name of the variable to be checked.

Return Value

Success: Returns 1 for Global variable or variable declared outside functions.
Special: -1 for Local variable.
Failure: Returns 0 when no variable can be found.

Example

If Not IsDeclared ("a") then
    MsgBox(0,"", "$a is NOT declared")     ; $a has never been assigned
EndIf

$a=1

If IsDeclared ("a") then
    MsgBox(0,"", "$a IS declared"  )      ; due to previous $a=1 assignment
EndIf

Related Functions

Assign Eval

Personal tools