done until quiz1

This commit is contained in:
2026-07-10 13:25:51 +02:00
parent 8f249751ea
commit e84e3ac8cc
7 changed files with 26 additions and 6 deletions
+12
View File
@@ -11,6 +11,18 @@
// TODO: Write a function that calculates the price of an order of apples given
// the quantity bought.
// fn calculate_price_of_apples(???) -> ??? { ??? }
fn calculate_price_of_apples(apples: i32) -> i32 {
let mut cost: i32 = 2;
if apples > 40 {
cost = 1;
cost *= apples;
cost
} else {
cost *= apples;
cost
}
}
fn main() {
// You can optionally experiment here.