1
0
mirror of https://github.com/rust-lang/rustlings.git synced 2025-12-01 22:51:45 +02:00

errors2 solution

This commit is contained in:
mo8it
2024-06-26 15:36:14 +02:00
parent 2afe6b38d3
commit 050a23ce67
3 changed files with 71 additions and 13 deletions

View File

@@ -660,12 +660,11 @@ One way to handle this is using a `match` statement on
`item_quantity.parse::<i32>()` where the cases are `Ok(something)` and
`Err(something)`.
This pattern is very common in Rust, though, so there's a `?` operator that
This pattern is very common in Rust, though, so there's the `?` operator that
does pretty much what you would make that match statement do for you!
Take a look at this section of the 'Error Handling' chapter:
https://doc.rust-lang.org/book/ch09-02-recoverable-errors-with-result.html#a-shortcut-for-propagating-errors-the--operator
and give it a try!"""
Take a look at this section of the "Error Handling" chapter:
https://doc.rust-lang.org/book/ch09-02-recoverable-errors-with-result.html#a-shortcut-for-propagating-errors-the--operator"""
[[exercises]]
name = "errors3"