Exerpad
🔥0
0 XP
Lv.1 Beginner
Log In

Shape Area

Define an enum called Shape with two variants:

  • Circle(f64) — holds the radius
  • Rectangle(f64, f64) — holds the width and height

Create a variable set to Shape::Rectangle(4.0, 5.0) and use match to compute and print the area:

  • Circle area = 3.14159 * radius * radius
  • Rectangle area = width * height

Expected output:

Area: 20

rust
fn main() {
}