In the previous challenge, you learned how to propagate errors using the Result<T, E>
type for file handling. Rust also lets you use the ?
operator to propagate Option<T>
values, but instead of propagating the error it will convert the Option<T>
into a None
value if it is None
.
This challenge focuses on propagating Option
values and handling scenarios where optional values might be missing.
Implement the function find_and_multiply
:
Vec<i32>
).usize
values).Option<i32>
.None
.?
operator to propagate None
values.