From 1ed08d9808a332e5d82a6c79da2cff71f7a1d259 Mon Sep 17 00:00:00 2001 From: NoneTheWisr <12655815+NoneTheWisr@users.noreply.github.com> Date: Fri, 28 Jan 2022 18:31:23 +0400 Subject: [PATCH] finish quiz1 --- exercises/quiz1.rs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/exercises/quiz1.rs b/exercises/quiz1.rs index 7bd3f589..201b96b5 100644 --- a/exercises/quiz1.rs +++ b/exercises/quiz1.rs @@ -8,10 +8,11 @@ // 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 { +fn calculate_apple_price(quantity: u32) -> u32 { + let price = if quantity > 40 { 1 } else {2}; + price * quantity +} // Don't modify this function! #[test]