(multi-statement expression) Topic is solved

Share your ideas as to how the documentation can be improved.
iPhilip
Posts: 791
Joined: 02 Oct 2013, 12:21

(multi-statement expression)

Post by iPhilip » 03 Oct 2022, 13:05

I would like to recommend that an entry be added to the Expression Operators section of the documentation to document the use of parentheses for multi-statement expressions.
I see many examples of its usage in the forum but, as far as I can see, it's not documented. Furthermore, the behavior differs between AutoHotkey v1 and v2.

The following statement might be combined with the (expression) entry:
For a multi-statement expression, the result of the first statement is returned. For example, (a := 1, b := 2, c := 3) returns 1.
For the AutoHotkey v2 documentation page, the statement could be:
For a multi-statement expression, the result of the last statement is returned. For example, (a := 1, b := 2, c := 3) returns 3.
Note that in the v2 documentation, there is an indirect reference to this behavior in the following line for the comma operator:
https://lexikos.github.io/v2/docs/Variables.htm#comma wrote:To include a multi-statement expression in a parameter list, enclose it in an extra set of parentheses. For example, MyFn((x, y)) evaluates both x and y but passes y as the first and only parameter of MyFn.
Windows 10 Pro (64 bit) - AutoHotkey v2.0+ (Unicode 64-bit)

User avatar
Ragnar
Posts: 608
Joined: 30 Sep 2013, 15:25

Re: (multi-statement expression)  Topic is solved

Post by Ragnar » 07 Oct 2022, 11:34

Thanks for reporting. Changes added in PR #570 and PR #579.

iPhilip
Posts: 791
Joined: 02 Oct 2013, 12:21

Re: (multi-statement expression)

Post by iPhilip » 07 Oct 2022, 16:25

Thank you, @Ragnar.
Windows 10 Pro (64 bit) - AutoHotkey v2.0+ (Unicode 64-bit)

Post Reply

Return to “Suggestions on Documentation Improvements”