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
The best way to learn is to practice. Below, you will find some of the solutions other golfers have entered. To unlock higher ranked solutions, submit your own entry which does as well or better than the solutions you can currently see - climb the ladder!
Check out these helpful resources to improve your Vim skills... Game on.
Unlock 52 remaining solutions by signing in and submitting your own entry
#53 Duy nguyễn / @Duycld03 - Score: 188 - 08/11/23 @ 13:55
Go<CR>fn value_in_cents(coin: Coin) -> u23<BS><BS>32 {<CR>}<Esc>komatch u<BS>coin [<BS>{<CR>}<Esc>kod<Esc>ddkkkkkkkkkjqq^yiwjjjjjjjoCoin::<Esc>pa +<BS>=> 1,<Esc>kkkkkkkq3@qGo<Esc>kkkkkkt,jlr5ji0<Esc>jwciw25<Esc>kkkVjjj>Vjjj<kVjjjjj<Vjjjjj>j:wq<CR>
0 comments