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]