From b59f38da23d69c3d2fa6a245c9211683b8c27294 Mon Sep 17 00:00:00 2001 From: Tomasz Waszczyk Date: Tue, 14 Jun 2022 18:25:33 +0200 Subject: [PATCH] added(): test commit --- exercises/if/if2.rs | 5 +++-- exercises/quiz1.rs | 8 +++++++- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/exercises/if/if2.rs b/exercises/if/if2.rs index 80effbdf..4d1ab2d4 100644 --- a/exercises/if/if2.rs +++ b/exercises/if/if2.rs @@ -4,13 +4,14 @@ // Step 2: Get the bar_for_fuzz and default_to_baz tests passing! // Execute the command `rustlings hint if2` if you want a hint :) -// I AM NOT DONE pub fn fizz_if_foo(fizzish: &str) -> &str { if fizzish == "fizz" { "foo" + } else if fizzish == "fuzz" { + "bar" } else { - 1 + "baz" } } diff --git a/exercises/quiz1.rs b/exercises/quiz1.rs index 7bd3f589..424f0cca 100644 --- a/exercises/quiz1.rs +++ b/exercises/quiz1.rs @@ -11,7 +11,13 @@ // I AM NOT DONE // Put your function here! -// fn calculate_apple_price { +fn calculate_apple_price(quantity: i32) -> i32 { + if quantity > 40 { + return quantity; + } else { + return quantity * 2; + } +} // Don't modify this function! #[test]