IsSet() [v1.1.35+]

Returns a non-zero number if the specified variable has been assigned a value.

VarIsSet := IsSet(Var)

Parameters

Var

A direct or dynamic variable reference. For example: IsSet(MyVar) or IsSet(%VarContainingName%).

Return Value

The return value is 1 (true) if Var has been assigned a value, otherwise 0 (false).

Remarks

A variable which has not been assigned a value is also known as an uninitialised variable.

This function is affected by the following technical limitations of AutoHotkey v1.1:

ByRef parameters

Examples

Shows different uses for IsSet.

Loop 2
    if !IsSet(MyVar)  ; Is this the first "use" of MyVar?
        MyVar := A_Index  ; Initialize on first "use".
MsgBox % "MyVar is " (IsSet(MyVar) ? "set and has value """ MyVar """" : "unset")