mirror of
https://github.com/google/comprehensive-rust.git
synced 2025-04-27 17:42:18 +02:00
Merge pull request #148 from fbornhofen/speaker-notes-if-let
Add speaker notes for if-let-expressions.md
This commit is contained in:
commit
4e746482f2
@ -15,3 +15,11 @@ fn main() {
|
|||||||
|
|
||||||
See [pattern matching](../pattern-matching.md) for more details on patterns in
|
See [pattern matching](../pattern-matching.md) for more details on patterns in
|
||||||
Rust.
|
Rust.
|
||||||
|
|
||||||
|
<details>
|
||||||
|
|
||||||
|
* `if let` can be more concise than `match`, e.g., when only one case is interesting. In contrast, `match` requires all branches to be covered.
|
||||||
|
* A common usage is handling `Some` values when working with `Option`.
|
||||||
|
* Unlike `match`, `if let` does not support guard clauses for pattern matching.
|
||||||
|
|
||||||
|
</details>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user