Complete if exercises (#3)
This commit is contained in:
parent
c09acc09b5
commit
9d16451196
|
@ -1,8 +1,11 @@
|
|||
// if1.rs
|
||||
|
||||
// I AM NOT DONE
|
||||
|
||||
pub fn bigger(a: i32, b: i32) -> i32 {
|
||||
if a > b {
|
||||
a
|
||||
} else {
|
||||
b
|
||||
}
|
||||
// Complete this function to return the bigger number!
|
||||
// Do not use:
|
||||
// - another function call
|
||||
|
|
|
@ -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"
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue