What's the utility of the return command in autohotkey?

Posted by Shashank Sawant on Super User See other posts from Super User or by Shashank Sawant
Published on 2013-10-13T01:18:11Z Indexed on 2013/10/17 16:05 UTC
Read the original article Hit count: 265

Filed under:

In the instances where the return command returns a value, the utility is obvious. I have seen the return command being used even when it is seemingly unnecessary. Let me show the following examples:

Example 1:

Loop
{
    if a_index > 25
        break  ; Terminate the loop
    if a_index < 20
        continue ; Skip the below and start a new iteration
    MsgBox, a_index = %a_index% ; This will display only the numbers 20 through 25
}

Example 2:

IfWinExist, Untitled - Notepad
{
    WinActivate  ; Automatically uses the window found above.   
    return
}

Why is the return command used in Example 2 but is not used in Example 1? Both examples are copy-pasted/modified-pasted from the autohotkey.com's documentation.

© Super User or respective owner

Related posts about autohotkey