Advanced Pattern Matching
Medium
+3 pts
Intro to Rust
14/15
🎯 Python 3.10 introduced structural pattern matching:
match command: case {"action": "move", "x": x, "y": y}: print(f"Moving to {x}, {y}") case {"action": "quit"}: print("Goodbye")
Rust's match goes further with features you'll use constantly: ranges, multiple patterns, guards, destructuring, and exhaustiveness checking. This exercise drills all of them.
Ranges and multiple patterns
match score { 90..=100 => "A", // range pattern 75..=89 | 70..=74 => "B/C", // multiple patterns with | _ …Login to see the full exercise.