From 3d134bac77c28c2988740b22a3e1c9b2b3c6eeeb Mon Sep 17 00:00:00 2001 From: lukaszKielar Date: Sun, 21 Jun 2020 20:37:49 +0200 Subject: [PATCH] finish quiz1 --- exercises/quiz1.rs | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/exercises/quiz1.rs b/exercises/quiz1.rs index 5c5c355d..4c7fbd1a 100644 --- a/exercises/quiz1.rs +++ b/exercises/quiz1.rs @@ -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]