@@ -53,11 +53,10 @@ assert_eq!(y, "Bigger");
5353
5454An ` if let ` expression is semantically similar to an ` if ` expression but in
5555place of a condition expression it expects the keyword ` let ` followed by a
56- pattern, an ` = ` and an expression. If the value of the expression on the right
57- hand side of the ` = ` matches the pattern, the corresponding block will
58- execute, otherwise flow proceeds to the following ` else ` block if it exists.
59- Like ` if ` expressions, ` if let ` expressions have a value determined by the
60- block that is evaluated.
56+ pattern, an ` = ` and a [ scrutinee] expression. If the value of the scrutinee
57+ matches the pattern, the corresponding block will execute. Otherwise, flow
58+ proceeds to the following ` else ` block if it exists. Like ` if ` expressions,
59+ ` if let ` expressions have a value determined by the block that is evaluated.
6160
6261``` rust
6362let dish = (" Ham" , " Eggs" );
@@ -75,8 +74,6 @@ if let ("Ham", b) = dish {
7574 println! (" Ham is served with {}" , b );
7675}
7776
78- // Irrefutable patterns are allowed primarily to make it easier for macros to
79- // accept any kind of pattern.
8077if let _ = 5 {
8178 println! (" Irrefutable patterns are always true" );
8279}
@@ -142,3 +139,4 @@ if let PAT = ( EXPR || EXPR ) { .. }
142139[ _Pattern_ ] : patterns.html
143140[ _LazyBooleanOperatorExpression_ ] : expressions/operator-expr.html#lazy-boolean-operators
144141[ _eRFCIfLetChain_ ] : https://github.com/rust-lang/rfcs/blob/master/text/2497-if-let-chains.md#rollout-plan-and-transitioning-to-rust-2018
142+ [ scrutinee ] : glossary.html#scrutinee
0 commit comments