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:
- Attempting to read a variable when #Warn UseUnset is enabled in MsgBox mode causes the variable to be marked as initialized to ensure the message is displayed only once for each variable. Subsequent calls to IsSet would return 1.
- IsSet cannot recognize built-in variables when called dynamically. Calling IsSet dynamically is not recommended.
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")