Returns from a subroutine to which execution had previously jumped via function-call, Hotkey activation, 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)


The space or tab after Return is optional if the expression is enclosed in parentheses, as in return(expression).

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, Exit, ExitApp


The first Return ensures that the subsequent function call is skipped if the preceding condition is true. The second Return is redundant when used at the end of a function like this.

#z::  ; Win-Z
^#z::  ; Ctrl-Win-Z
    MsgBox "A Win-Z hotkey was pressed."
    if GetKeyState("Ctrl")
        return  ; Finish early, skipping the function call below.

    Sleep 1000
    return  ; Redundant when used at the end of the function like this.