From 0d02a15cca710c1c7e42aceaa127dc5c2ab1a195 Mon Sep 17 00:00:00 2001 From: Phan Huy Hoang Date: Sun, 1 Jan 2023 00:53:18 +0700 Subject: [PATCH] [Add] exercises/quiz1.rs --- exercises/quiz1.rs | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/exercises/quiz1.rs b/exercises/quiz1.rs index dbb5cdc9..f2b51657 100644 --- a/exercises/quiz1.rs +++ b/exercises/quiz1.rs @@ -10,10 +10,14 @@ // 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_price_of_apples { +fn calculate_price_of_apples (apple_count: i32) -> i32 { + if apple_count > 40 { + apple_count + } else { + apple_count * 2 + } +} // Don't modify this function! #[test]