Completed if exercises

This commit is contained in:
Juan-LukeKlopper 2023-04-27 16:34:17 +02:00
parent 7b3dbfdead
commit 8c88b40060
2 changed files with 8 additions and 4 deletions

View File

@ -1,13 +1,16 @@
// 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 :)

View File

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