Handling things that can fail
Rust has no exceptions. A function that can fail says so in its return type, so the caller cannot silently ignore it.
Step 1 of 3
Model 'maybe nothing' with Option
Write a function returning `Option<i32>` and handle both cases with `match`.
There is no null in Rust. Absence is a value you must unwrap deliberately.
Checkpoints
- A function returns `Option<...>` — not yet passed
- Both `Some` and `None` are handled — not yet passed
- The program compiles and runs without errors — not yet passed