1
0
mirror of https://github.com/google/comprehensive-rust.git synced 2025-04-25 16:54:32 +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:
Charisee Chiw 2023-01-30 03:47:56 -08:00 committed by GitHub
parent 1040115d8c
commit 49d24f89cf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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 See [pattern matching](../pattern-matching.md) for more details on patterns in
Rust. 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>