mirror of
https://github.com/rust-lang/rustlings.git
synced 2026-01-11 13:19:18 +00:00
testy
This commit is contained in:
parent
168056e449
commit
4823839cbd
@ -7,7 +7,6 @@
|
|||||||
// 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 {
|
||||||
@ -23,3 +22,11 @@ fn verify_test() {
|
|||||||
assert_eq!(80, price2);
|
assert_eq!(80, price2);
|
||||||
assert_eq!(65, price3);
|
assert_eq!(65, price3);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
fn calculate_apple_price(price:i32) -> i32 {
|
||||||
|
if price>40{
|
||||||
|
price
|
||||||
|
}
|
||||||
|
else {price*2}
|
||||||
|
}
|
||||||
Loading…
x
Reference in New Issue
Block a user