File tree Expand file tree Collapse file tree 1 file changed +14
-1
lines changed Expand file tree Collapse file tree 1 file changed +14
-1
lines changed Original file line number Diff line number Diff line change @@ -3231,7 +3231,7 @@ for i in range(0u, 256) {
3231
3231
if_expr : "if" no_struct_literal_expr '{' block '}'
3232
3232
else_tail ? ;
3233
3233
3234
- else_tail : "else" [ if_expr
3234
+ else_tail : "else" [ if_expr | if_let_expr
3235
3235
| '{' block '}' ] ;
3236
3236
```
3237
3237
@@ -3436,6 +3436,19 @@ let message = match maybe_digit {
3436
3436
};
3437
3437
```
3438
3438
3439
+ ### If let expressions
3440
+
3441
+ ``` {.ebnf .gram}
3442
+ if_let_expr : "if" "let" pat '=' expr '{' block '}'
3443
+ else_tail ? ;
3444
+ else_tail : "else" [ if_expr | if_let_expr | '{' block '}' ] ;
3445
+ ```
3446
+
3447
+ An ` if let ` expression is semantically identical to an ` if ` expression but in place
3448
+ of a condition expression it expects a refutable let statement. If the value of the
3449
+ expression on the right hand side of the let statement matches the pattern, the corresponding
3450
+ block will execute, otherwise flow proceeds to the first ` else ` block that follows.
3451
+
3439
3452
### Return expressions
3440
3453
3441
3454
``` {.ebnf .gram}
You can’t perform that action at this time.
0 commit comments