RUST match with enum for Coin
RUST match with enum for Coin rusty practice on vimgolf
Start file
enum Coin { Penny, Nickel, Dime, Quarter, }
End file
enum Coin { Penny, Nickel, Dime, Quarter, } fn value_in_cents(coin: Coin) -> u32 { match coin { Coin::Penny => 1, Coin::Nickel => 5, Coin::Dime => 10, Coin::Quarter => 25, } }
View Diff
6a7,15 > > fn value_in_cents(coin: Coin) -> u32 { > match coin { > Coin::Penny => 1, > Coin::Nickel => 5, > Coin::Dime => 10, > Coin::Quarter => 25, > } > }
Solutions by @Luoyb:
Unlock 3 remaining solutions by signing in and submitting your own entry