6.4 Parentheses for Grouping
Any expression wrapped in parentheses is also an expression. Like in C++, but unlike in R, only the round parentheses,
), are allowed. The square brackets
] are reserved for array indexing and the curly braces
} for grouping statements.
With parentheses it is possible to explicitly group subexpressions with operators. Without parentheses, the expression
1 + 2 * 3 has a subexpression
2 * 3 and evaluates to 7. With parentheses, this grouping may be made explicit with the expression
1 + (2 * 3). More importantly, the expression
(1 + 2) * 3 has
1 + 2 as a subexpression and evaluates to 9.