This commit is contained in:
blacktoast 2021-10-05 19:59:55 +09:00
parent 168056e449
commit 4823839cbd

View File

@ -7,7 +7,6 @@
// 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!
// I AM NOT DONE
// Put your function here!
// fn calculate_apple_price {
@ -23,3 +22,11 @@ fn verify_test() {
assert_eq!(80, price2);
assert_eq!(65, price3);
}
fn calculate_apple_price(price:i32) -> i32 {
if price>40{
price
}
else {price*2}
}