Not operator needs parentheses in if statement
samarseneault opened this issue · comments
Samuel Arseneault commented
In a composite "if" statement combining expressions with a boolean operator, if the second expression contains a "not" operator, then the second expression must be surrounded by parentheses. Not doing so causes a compilation error (Syntax error: expected identifier, found logic not).
For example:
function init() {
# This is invalid syntax and causes a compilation error
if (1 and not 0) {
log("hello")
}
# This is valid syntax
if (1 and (not 0)) {
log("hello")
}
}
This requirement seems unintuitive when comparing to languages like Python, where the parentheses would not be necessary.