Skip to content

Commit 821a152

Browse files
committed
Add a note about block like statements
1 parent acedc32 commit 821a152

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

src/statements.md

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,12 @@ declaration until the end of the enclosing block scope.
3636

3737
## Expression statements
3838

39-
An _expression statement_ is one that evaluates an [expression](expressions.html)
40-
and ignores its result. The type of an expression statement `e;` is always
41-
`()`, regardless of the type of `e`. As a rule, an expression statement's
42-
purpose is to trigger the effects of evaluating its expression.
39+
An _expression statement_ is one that evaluates an
40+
[expression](expressions.html) and ignores its result. The type of an
41+
expression statement `e;` is always `()`, regardless of the type of `e`. As a
42+
rule, an expression statement's purpose is to trigger the effects of evaluating
43+
its expression. [Block expressions](expressions.html#block-expressions) and
44+
control flow expressions, such as [`loop`
45+
expressions](expressions.html#infinite-loops) and [`if`
46+
expressions](expressions.html#if-expressions), which evaluate to `()` can be
47+
used as statements without a trailing semicolon.

0 commit comments

Comments
 (0)