mirror of
https://github.com/rust-lang/rustlings.git
synced 2026-01-11 05:09:19 +00:00
finish quiz1
This commit is contained in:
parent
df11d5b28a
commit
1ed08d9808
@ -8,10 +8,11 @@
|
|||||||
// more than 40 at once, each apple only costs 1! Write a function that calculates
|
// more than 40 at once, each apple only costs 1! Write a function that calculates
|
||||||
// the price of an order of apples given the quantity bought. No hints this time!
|
// the price of an order of apples given the quantity bought. No hints this time!
|
||||||
|
|
||||||
// I AM NOT DONE
|
|
||||||
|
|
||||||
// Put your function here!
|
// Put your function here!
|
||||||
// fn calculate_apple_price {
|
fn calculate_apple_price(quantity: u32) -> u32 {
|
||||||
|
let price = if quantity > 40 { 1 } else {2};
|
||||||
|
price * quantity
|
||||||
|
}
|
||||||
|
|
||||||
// Don't modify this function!
|
// Don't modify this function!
|
||||||
#[test]
|
#[test]
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user