Loading lesson…
Level 1 · Apprentice0 XP
Model data with structs and enums, and handle every case with match.
Step 1 / 6
ProblemA Kotlin developer knows null safety; a Java developer knows NullPointerException. Rust has no null at all.
← → step
Before this: Lifetimes without fear
🛠️ Your turn
Reading is not the skill, doing is. Try for ten minutes before you open the hint. Getting stuck first is what makes the solution stick.
1.Model an order state machine as an enum (Placed, Paid { at }, Shipped { carrier }, Cancelled { reason }) with a method that returns the next allowed states, and match exhaustively in a describe function. Add a variant and let the compiler show every match to update.