What's the utility of the return command in autohotkey?
- by Shashank Sawant
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.