diff --git a/exercises/if/if1.rs b/exercises/if/if1.rs index 587e03f8..7f4f5738 100644 --- a/exercises/if/if1.rs +++ b/exercises/if/if1.rs @@ -1,15 +1,13 @@ // if1.rs // Execute `rustlings hint if1` or use the `hint` watch subcommand for a hint. -// I AM NOT DONE - pub fn bigger(a: i32, b: i32) -> i32 { - // Complete this function to return the bigger number! - // Do not use: - // - another function call - // - additional variables + if a > b { + a + } else { + b + } } - // Don't mind this for now :) #[cfg(test)] mod tests { diff --git a/exercises/if/if2.rs b/exercises/if/if2.rs index effddbb6..0bfc9cef 100644 --- a/exercises/if/if2.rs +++ b/exercises/if/if2.rs @@ -4,16 +4,15 @@ // Step 2: Get the bar_for_fuzz and default_to_baz tests passing! // Execute `rustlings hint if2` or use the `hint` watch subcommand for a hint. -// I AM NOT DONE - pub fn foo_if_fizz(fizzish: &str) -> &str { if fizzish == "fizz" { "foo" + } else if fizzish == "fuzz" { + "bar" } else { - 1 + "baz" } } - // No test changes needed! #[cfg(test)] mod tests {