Core Beginner
03 Pattern matching
match lets you branch on shape and value at once. Map coins to cents, then classify a point by which axis it sits on.
In apply_bonus, add the bonus only when it is Some -- use if let.
Hints
if let Some(b) = bonus { ... } else { ... }-- a match for when you only care about one pattern.
Reveal solution
fn apply_bonus(score: u32, bonus: Option<u32>) -> u32 {
if let Some(b) = bonus {
score + b
} else {
score
}
}