You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/expressions/if-expr.md
+4-1
Original file line number
Diff line number
Diff line change
@@ -41,12 +41,15 @@ assert_eq!(y, "Bigger");
41
41
42
42
> **<sup>Syntax</sup>**\
43
43
> _IfLetExpression_ :\
44
-
> `if``let`[_Pattern_]`=`[_Expression_]<sub>_except struct or lazy boolean operator expression_</sub>
44
+
> `if``let`[_Pattern_]`=`Scrutinee
45
45
> [_BlockExpression_]\
46
46
> (`else` (
47
47
> [_BlockExpression_]
48
48
> | _IfExpression_
49
49
> | _IfLetExpression_ ) )<sup>\?</sup>
50
+
>
51
+
> _Scrutinee_:
52
+
> [_Expression_]<sub>_except struct or lazy boolean operator expression_</sub>
50
53
51
54
An `if let` expression is semantically similar to an `if` expression but in place of a condition operand it expects the keyword `let` followed by a pattern, an `=` and a [scrutinee] operand.
52
55
If the value of the scrutinee matches the pattern, the corresponding block will execute.
0 commit comments