diff --git a/src/ch19-03-pattern-syntax.md b/src/ch19-03-pattern-syntax.md index 21c1137d95..d685f87bf6 100644 --- a/src/ch19-03-pattern-syntax.md +++ b/src/ch19-03-pattern-syntax.md @@ -19,15 +19,15 @@ value. ### Matching Named Variables Named variables are irrefutable patterns that match any value, and we’ve used -them many times in the book. However, there is a complication when you use -named variables in `match` expressions. Because `match` starts a new scope, -variables declared as part of a pattern inside the `match` expression will -shadow those with the same name outside the `match` construct, as is the case -with all variables. In Listing 19-11, we declare a variable named `x` with the -value `Some(5)` and a variable `y` with the value `10`. We then create a -`match` expression on the value `x`. Look at the patterns in the match arms and -`println!` at the end, and try to figure out what the code will print before -running this code or reading further. +them many times in the book. However, there is a complication when you use named +variables in `match`, `if let`, or `while let` expressions. Because each of +these kinds of expression starts a new scope, variables declared as part of a +pattern inside the expression will shadow those with the same name outside, as +is the case with all variables. In Listing 19-11, we declare a variable named +`x` with the value `Some(5)` and a variable `y` with the value `10`. We then +create a `match` expression on the value `x`. Look at the patterns in the match +arms and `println!` at the end, and try to figure out what the code will print +before running this code or reading further.