nothing in the documentation suggests that the parentheses are optional.
Really? Not even the examples on the IF page?
Code: Select all
if (x < y) {
; ...
}
if WinExist("Untitled - Notepad") {
WinActivate
}
if IsDone {
; ...
} else {
; ...
}
There are actually various examples throughout the documentation that do not use parentheses.
The space after if is optional if the expression starts with an open-parenthesis, as in if(expression).
This suggests that the expression does not necessarily have to start with an open-parenthesis; otherwise, the space would
always be optional.
Parentheses have never been a required part of the syntax, but
something is often needed to disambiguate in v1. It is not needed in v2 and could be removed from the
syntax block at the top of the IF page. There is no need to change the examples, which already show that using parentheses is valid but not mandatory.