Exerpad
🔥 0
0 XP
Exercise 5 · Chapter: Enums & Pattern MatchingRequired+50 XP

Coin Value

Define an enum called Coin with four variants: Penny, Nickel, Dime, and Quarter.

Create a variable set to Coin::Dime and use match to print how many cents each coin is worth:

  • Penny => 1 cent
  • Nickel => 5 cents
  • Dime => 10 cents
  • Quarter => 25 cents

Expected output:

10 cents

rust
fn main() {
}
Output
Run your code to see the output here.