AutoHotkey v2 throws if a function receives a bad parameter count
AutoHotkey v2 has no real way of differentiating between a multi-expression comma and command list in this case
AutoHotkey v2 apparently evaluates return and similar control flow statements as functions being called in command style and verifies their parameter count before the script starts.
The combination of this leads to very suprising behaviour when combining multi-expression comma with control statements in command style mode.
The code:
Code: Select all
Msgbox "Hello World"
fn()
fn() {
return a := 0, b := 1
}
Code: Select all
"Return" accepts at most 1 parameter.
Specifically: return a := 0, b := 1
https://github.com/Lexikos/AutoHotkey_L/blob/alpha/source/script.cpp#L9068