mirror of
https://github.com/google/comprehensive-rust.git
synced 2025-04-25 00:50:26 +02:00
Speaker notes for while-let-expressions.md (#294)
* Speaker notes for while-let-expressions.md #274 * Update while-let-expressions.md --------- Co-authored-by: Andrew Walbran <qwandor@google.com>
This commit is contained in:
parent
1040115d8c
commit
49d24f89cf
@ -20,3 +20,11 @@ return `None`. The `while let` lets us keep iterating through all items.
|
||||
|
||||
See [pattern matching](../pattern-matching.md) for more details on patterns in
|
||||
Rust.
|
||||
|
||||
|
||||
<details>
|
||||
|
||||
* Point out that the `while let` loop will keep going as long as the value matches the pattern.
|
||||
* You could rewrite the `while let` loop as an infinite loop with an if statement that breaks when there is no value to unwrap for `iter.next()`. The `while let` provides syntactic sugar for the above scenario.
|
||||
|
||||
</details>
|
||||
|
Loading…
x
Reference in New Issue
Block a user