This commit is contained in:
stephan.klauberg 2023-09-23 18:13:15 +02:00
parent 7250f5077a
commit 3006c94a91
3 changed files with 14 additions and 6 deletions

View File

@ -2,13 +2,18 @@
//
// Execute `rustlings hint if1` or use the `hint` watch subcommand for a hint.
// I AM NOT DONE
// I AM 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

@ -5,13 +5,16 @@
//
// Execute `rustlings hint if2` or use the `hint` watch subcommand for a hint.
// I AM NOT DONE
// I AM DONE
pub fn foo_if_fizz(fizzish: &str) -> &str {
if fizzish == "fizz" {
"foo"
} else if fizzish == "fuzz" {
"bar"
} else {
1
"baz"
}
}

View File

@ -2,17 +2,17 @@
//
// Execute `rustlings hint if3` or use the `hint` watch subcommand for a hint.
// I AM NOT DONE
// I AM DONE
pub fn animal_habitat(animal: &str) -> &'static str {
let identifier = if animal == "crab" {
1
} else if animal == "gopher" {
2.0
2
} else if animal == "snake" {
3
} else {
"Unknown"
0
};
// DO NOT CHANGE THIS STATEMENT BELOW