Challenge 1: A Shape Enum With match — Possible Solution ==================================================================== enum Shape { Circle(f64), Rectangle(f64, f64), } fn area(shape: &Shape) -> f64 { match shape { Shape::Circle(radius) => 3.14159 * radius * radius, Shape::Rectangle(width, height) => width * height, } } fn main() { let c = Shape::Circle(4.0); let r = Shape::Rectangle(3.0, 5.0); println!("Circle area: {}", area(&c)); println!("Rectangle area: {}", area(&r)); } WHY THIS WORKS AS AN ANSWER ------------------------------ Shape::Circle(f64) and Shape::Rectangle(f64, f64) are two variants carrying genuinely DIFFERENT data — one number vs. two — exactly the "variants can carry their own shape of data" capability this chapter introduced, something Go's iota constants have no equivalent for. The match expression is EXHAUSTIVE: both variants have an arm, so the compiler accepts it without needing a catch-all _. Each arm DESTRUCTURES the variant's data directly — Shape::Circle(radius) binds the single f64 to radius, and Shape::Rectangle(width, height) binds both f64s at once — making each arm's calculation immediately usable with no manual unwrapping step. Calling area(&c) and area(&r) borrows each shape (Chapter 4's &), letting the function compute an area without taking ownership of either shape value.