Returns from a function or subroutine to which execution had previously jumped via function-call, Gosub, Hotkey activation, GroupActivate, or other means.
Return , Expression
This parameter can only be used within a function.
If omitted, it defaults to an empty string.
Since this parameter is an expression, all of the following lines are valid:
return 3 return "literal string" return MyVar return i + 1 return true ; Returns the number 1 to mean "true". return ItemCount < MaxItems ; Returns a true or false value. return FindColor(TargetColor)
Known limitation: For backward compatibility and ease-of-use, the following two lines are functionally identical:
return MyVar return %MyVar%
In other words, a single variable enclosed in percent signs is treated as a non-expression. To work around this, make it unambiguously an expression by enclosing it in parentheses; for example: return (%MyVar%)
.
If there is no caller to which to return, Return will do an Exit instead.
There are various ways to return multiple values from function to caller described within Returning Values to Caller.
Functions, Gosub, Exit, ExitApp, GroupActivate