Slug: enum-match-03 · Paired reading: Chapters 2 and 7
Prompt
fn classify(n: i32) -> &'static str using @ and guards — e.g.
n @ 1..=9 if n % 2 == 0 → small-even, odd small → small-odd,
0 → zero, negative → neg, else other.
The curriculum, drills, tutor, and interviewer mode are for readers of Ace the Rust Interview. The code is printed in the Preface (Companion site access).
Don’t have the book yet? The landing page stays open — purchase unlocks this gym.
beginner · order 39
Slug: enum-match-03 · Paired reading: Chapters 2 and 7
fn classify(n: i32) -> &'static str using @ and guards — e.g.
n @ 1..=9 if n % 2 == 0 → small-even, odd small → small-odd,
0 → zero, negative → neg, else other.