Skip to content

Commit

Permalink
Merge pull request #4113 from rust-lang/push-lplqmmmnzrnr
Browse files Browse the repository at this point in the history
Very small clarification on if let
  • Loading branch information
chriskrycho authored Nov 26, 2024
2 parents dffa6a9 + 398eb06 commit fb3b8fc
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/ch06-03-if-let.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ sign. It works the same way as a `match`, where the expression is given to the
`match` and the pattern is its first arm. In this case, the pattern is
`Some(max)`, and the `max` binds to the value inside the `Some`. We can then
use `max` in the body of the `if let` block in the same way we used `max` in
the corresponding `match` arm. The code in the `if let` block isn’t run if the
value doesn’t match the pattern.
the corresponding `match` arm. The code in the `if let` block only runs if the
value matches the pattern.

Using `if let` means less typing, less indentation, and less boilerplate code.
However, you lose the exhaustive checking that `match` enforces. Choosing
Expand Down

0 comments on commit fb3b8fc

Please sign in to comment.