Exerpad
🔥 0
0 XP
Exercise 9 · Chapter: Enums & Pattern MatchingOptional+50 XP

Fix the Option

This program tries to get a value from a vector, but it doesn't handle the None case!

Fix the code so it properly handles both Some and None using match.

Hint: The .get() method returns an Option. You need to match on both Some(value) and None.

Expected output
Score: 100
rust
fn main() {
let scores = vec![100, 85, 92];
let result = scores.get(0);

if result {
println!("Score: {}", result);
}
}
Output
Run your code to see the output here.