From d42f0dcd46f46dfba391604685922a65aaaa9dce Mon Sep 17 00:00:00 2001 From: Fabian Bornhofen Date: Tue, 10 Jan 2023 18:30:22 +0100 Subject: [PATCH] Add speaker notes for if-let-expressions.md --- src/control-flow/if-let-expressions.md | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/control-flow/if-let-expressions.md b/src/control-flow/if-let-expressions.md index 3f44e948..813a49a4 100644 --- a/src/control-flow/if-let-expressions.md +++ b/src/control-flow/if-let-expressions.md @@ -15,3 +15,11 @@ fn main() { See [pattern matching](../pattern-matching.md) for more details on patterns in Rust. + +
+ +* `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. + +