mirror of
https://github.com/rust-lang/rustlings.git
synced 2026-01-05 10:19:18 +00:00
finish quiz1
This commit is contained in:
parent
d712ba713f
commit
3d134bac77
@ -7,10 +7,14 @@
|
||||
// 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!
|
||||
|
||||
// I AM NOT DONE
|
||||
|
||||
// Put your function here!
|
||||
// fn ..... {
|
||||
fn calculate_apple_price(num: u32) -> u32 {
|
||||
if num > 40 {
|
||||
num
|
||||
} else {
|
||||
num * 2
|
||||
}
|
||||
}
|
||||
|
||||
// Don't modify this function!
|
||||
#[test]
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user