Skip to content

Commit da06bec

Browse files
committed
Add some identifiers
1 parent b324507 commit da06bec

File tree

2 files changed

+14
-0
lines changed

2 files changed

+14
-0
lines changed

Diff for: src/expressions/if-expr.md

+5
Original file line numberDiff line numberDiff line change
@@ -107,10 +107,14 @@ if let E::X(n) | E::Y(n) = v {
107107
r[expr.if.chains]
108108
## Chains of conditions
109109

110+
r[expr.if.chains.intro]
110111
Multiple condition operands can be separated with `&&`.
112+
113+
r[expr.if.chains.order]
111114
Similar to a `&&` [_LazyBooleanOperatorExpression_], each operand is evaluated from left-to-right until an operand evaluates as `false` or a `let` match fails,
112115
in which case the subsequent operands are not evaluated.
113116

117+
r[expr.if.chains.bindings]
114118
The bindings of each pattern are put into scope to be available for the next condition operand and the consequent block.
115119

116120
The following is an example of chaining multiple expressions, mixing `let` bindings and boolean expressions, and with expressions able to reference pattern bindings from previous expressions:
@@ -144,6 +148,7 @@ fn nested() {
144148
}
145149
```
146150

151+
r[expr.if.chains.or]
147152
If any condition operand is a `let` pattern, then none of the condition operands can be a `||` [lazy boolean operator expression][_LazyBooleanOperatorExpression_] due to ambiguity and precedence with the `let` scrutinee.
148153
If a `||` expression is needed, then parentheses can be used. For example:
149154

Diff for: src/expressions/loop-expr.md

+9
Original file line numberDiff line numberDiff line change
@@ -66,17 +66,26 @@ r[expr.loop.while]
6666
> &nbsp;&nbsp; &nbsp;&nbsp; [_Expression_]<sub>_except struct expression_</sub>\
6767
> &nbsp;&nbsp; | `let` [_Pattern_] `=` [_Scrutinee_]
6868
69+
r[expr.loop.while.intro]
6970
A `while` loop expression allows repeating the evaluation of a block while a set of conditions remain true.
71+
72+
r[expr.loop.while.syntax]
7073
The syntax of a `while` expression is a sequence of one or more condition operands separated by `&&`,
7174
followed by a [_BlockExpression_].
7275

76+
r[expr.loop.while.condition]
7377
Condition operands must be either an [_Expression_] with a [boolean type] or a conditional `let` match.
7478
If all of the condition operands evaluate to `true` and all of the `let` patterns successfully match their [scrutinee]s,
7579
then the loop body block executes.
80+
81+
r[expr.loop.while.repeat]
7682
After the loop body successfully executes, the condition operands are re-evaluated to determine if the body should be executed again.
83+
84+
r[expr.loop.while.exit]
7785
If any condition operand evaluates to `false` or any `let` pattern does not match its scrutinee,
7886
the body is not executed and execution continues after the `while` expression.
7987

88+
r[expr.loop.while.eval]
8089
A `while` expression evaluates to `()`.
8190

8291
An example:

0 commit comments

Comments
 (0)