IsSet() [v1.1.35+]

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

VarIsSet := IsSet(Var)

매개변수

Var

A direct or dynamic variable reference. 예를 들어: IsSet(MyVar) or IsSet(%VarContainingName%).

반환 값

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

논평

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

예제

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")