mirror of https://github.com/KaiserY/trpl-zh-cn
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
23 lines
343 B
23 lines
343 B
3 years ago
|
enum Coin {
|
||
|
Penny,
|
||
|
Nickel,
|
||
|
Dime,
|
||
|
Quarter,
|
||
|
}
|
||
|
|
||
|
// ANCHOR: here
|
||
|
fn value_in_cents(coin: Coin) -> u8 {
|
||
|
match coin {
|
||
|
Coin::Penny => {
|
||
|
println!("Lucky penny!");
|
||
|
1
|
||
|
}
|
||
|
Coin::Nickel => 5,
|
||
|
Coin::Dime => 10,
|
||
|
Coin::Quarter => 25,
|
||
|
}
|
||
|
}
|
||
|
// ANCHOR_END: here
|
||
|
|
||
|
fn main() {}
|