Solve if exercises.

This commit is contained in:
Leonardo Freua 2021-09-14 10:18:04 -03:00
parent f2e63bb0c0
commit 1d906f8d0a
2 changed files with 4 additions and 5 deletions

View File

@ -1,13 +1,12 @@
// if1.rs
// 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
// Execute `rustlings hint if1` for hints
return if a > b { a } else { b }
}
// Don't mind this for now :)

View File

@ -4,13 +4,13 @@
// 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"
}
}