diff options
| author | bluecereal <singedsalami@gmail.com> | 2017-01-21 02:24:48 -0500 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2017-01-21 02:24:48 -0500 |
| commit | ebf07da0a502acba5fe29b085c3244834e4e3bf5 (patch) | |
| tree | 227f857eba5ed7208f733b50c09e2cf011267dbe | |
| parent | 4495f7e51e1d8e42440419bf97dfd04b28b544c4 (diff) | |
| download | rust-ebf07da0a502acba5fe29b085c3244834e4e3bf5.tar.gz rust-ebf07da0a502acba5fe29b085c3244834e4e3bf5.zip | |
Update if-let.md
| -rw-r--r-- | src/doc/book/if-let.md | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/doc/book/if-let.md b/src/doc/book/if-let.md index 35808b0ed9f..2231dddf204 100644 --- a/src/doc/book/if-let.md +++ b/src/doc/book/if-let.md @@ -1,9 +1,8 @@ % if let -`if let` is a figurative combination of `if` and `let`. `if let` does not literally -mean `if` + `let` to the compiler; it has its own special meaning,which was added for -convenience and as a way to reduce the overhead of certain kinds of pattern matches. - +`if let` allows us to match [patterns][patterns] within the condition of an [if][if]. +As a consequence, we reduce the overhead of certain kinds of [pattern][patterns] matches +and express them in a more convenient way. For example, let’s say we have some sort of `Option<T>`. We want to call a function on it if it’s `Some<T>`, but do nothing if it’s `None`. That looks like this: @@ -82,3 +81,4 @@ while let Some(x) = v.pop() { ``` [patterns]: patterns.html +[if]: if.html |
