shuffle shuffle

This commit is contained in:
2021-09-12 10:55:12 -04:00
parent 278ec88944
commit 7e976ccc6f
23 changed files with 0 additions and 0 deletions

5
rustbook/matchy/Cargo.lock generated Normal file
View File

@@ -0,0 +1,5 @@
# This file is automatically @generated by Cargo.
# It is not intended for manual editing.
[[package]]
name = "matchy"
version = "0.1.0"

View File

@@ -0,0 +1,9 @@
[package]
name = "matchy"
version = "0.1.0"
authors = ["Dan Buch <dan@meatballhat.com>"]
edition = "2018"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]

View File

@@ -0,0 +1,22 @@
enum Coin {
Penny,
Nickel,
Dime,
Quarter,
}
fn value_in_cents(coin: Coin) -> u8 {
match coin {
Coin::Penny => 1,
Coin::Nickel => 5,
Coin::Dime => 10,
Coin::Quarter => 25,
}
}
fn main() {
println!("Penny is {:?}", value_in_cents(Coin::Penny));
println!("Nickel is {:?}", value_in_cents(Coin::Nickel));
println!("Dime is {:?}", value_in_cents(Coin::Dime));
println!("Quarter is {:?}", value_in_cents(Coin::Quarter));
}