Skip to content

Commit 2eda013

Browse files
committed
Add documentation about paretheses for grouping expressions
1 parent 3d9f50a commit 2eda013

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

doc/rust.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1705,6 +1705,22 @@ as
17051705

17061706
Operators at the same precedence level are evaluated left-to-right.
17071707

1708+
### Grouped expressions
1709+
1710+
An expression enclosed in parentheses evaluates to the result of the enclosed
1711+
expression. Parentheses can be used to explicitly specify evaluation order
1712+
within an expression.
1713+
1714+
~~~~~~~~{.ebnf .gram}
1715+
paren_expr : '(' expr ')' ;
1716+
~~~~~~~~
1717+
1718+
An example of a parenthesized expression:
1719+
1720+
~~~~
1721+
let x = (2 + 3) * 4;
1722+
~~~~
1723+
17081724
### Unary copy expressions
17091725

17101726
~~~~~~~~{.ebnf .gram}

0 commit comments

Comments
 (0)