This is an old version, view current version.
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, (
and
)
, are allowed. The square brackets [
and ]
are
reserved for array indexing and the curly braces {
and
}
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.