Returns from a subroutine to which execution had previously jumped via function-call, Gosub, Hotkey activation, GroupActivate, or other means.
Return , Expression
This parameter should be omitted except when
return is used inside a function.
Since this parameter is an expression, all of the following are valid examples:
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 examples 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:
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