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:
@@ -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"
|
||||
|
||||
Reference in New Issue
Block a user