mirror of
https://github.com/rust-lang/rustlings.git
synced 2026-01-09 04:09:20 +00:00
parent
9d16451196
commit
b48abc99a1
@ -7,10 +7,15 @@
|
|||||||
// 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 order amount. No hints this time!
|
// the price of an order of apples given the order amount. No hints this time!
|
||||||
|
|
||||||
// I AM NOT DONE
|
|
||||||
|
|
||||||
// Put your function here!
|
// Put your function here!
|
||||||
// fn ..... {
|
// fn ..... {
|
||||||
|
fn calculate_apple_price(count: u32) -> u32 {
|
||||||
|
if count > 40 {
|
||||||
|
count
|
||||||
|
} else {
|
||||||
|
count * 2
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Don't modify this function!
|
// Don't modify this function!
|
||||||
#[test]
|
#[test]
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user