Skip to content

Commit c62db3e

Browse files
author
Jakub Wieczorek
committed
---
yaml --- r: 135251 b: refs/heads/snap-stage3 c: e53f4a6 h: refs/heads/master i: 135249: f84c765 135247: 6d73149 v: v3
1 parent 0b0363a commit c62db3e

File tree

2 files changed

+15
-2
lines changed

2 files changed

+15
-2
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
refs/heads/master: 74090504219e4e37c1a6d9fdd8600f44b51c7b04
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
4-
refs/heads/snap-stage3: 13e00e4a3d18802ca6407e59935be9f2c33ec061
4+
refs/heads/snap-stage3: e53f4a6b94623076a912df0c770c591d710c5de0
55
refs/heads/try: 14378ea357c06c23607ca61ade44f60a7a64a1c7
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b

branches/snap-stage3/src/doc/reference.md

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3231,7 +3231,7 @@ for i in range(0u, 256) {
32313231
if_expr : "if" no_struct_literal_expr '{' block '}'
32323232
else_tail ? ;
32333233
3234-
else_tail : "else" [ if_expr
3234+
else_tail : "else" [ if_expr | if_let_expr
32353235
| '{' block '}' ] ;
32363236
```
32373237

@@ -3436,6 +3436,19 @@ let message = match maybe_digit {
34363436
};
34373437
```
34383438

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+
34393452
### Return expressions
34403453

34413454
```{.ebnf .gram}

0 commit comments

Comments
 (0)