Return

Returns from a subroutine to which execution had previously jumped via function-call, Gosub, Hotkey activation, GroupActivate, or other means.

Return [, Value]

 

Parameters

Value

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)

 

Remarks

If there is no caller to which to return, Return will do an Exit instead.

 

Related

Functions, Gosub, Exit, ExitApp, GroupActivate

 

Example

#z::
MsgBox, The Win-Z hotkey was pressed.
Gosub, WinZ
return

WinZ:
Sleep, 1000
return