if
This commit is contained in:
parent
261736a355
commit
719ffc0cc9
|
@ -1,13 +1,11 @@
|
||||||
// if1.rs
|
// if1.rs
|
||||||
|
|
||||||
// I AM NOT DONE
|
|
||||||
|
|
||||||
pub fn bigger(a: i32, b: i32) -> i32 {
|
pub fn bigger(a: i32, b: i32) -> i32 {
|
||||||
// Complete this function to return the bigger number!
|
if a > b{
|
||||||
// Do not use:
|
return a;
|
||||||
// - another function call
|
}
|
||||||
// - additional variables
|
return b;
|
||||||
// Execute `rustlings hint if1` for hints
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Don't mind this for now :)
|
// Don't mind this for now :)
|
||||||
|
|
|
@ -4,13 +4,16 @@
|
||||||
// Step 2: Get the bar_for_fuzz and default_to_baz tests passing!
|
// Step 2: Get the bar_for_fuzz and default_to_baz tests passing!
|
||||||
// Execute the command `rustlings hint if2` if you want a hint :)
|
// Execute the command `rustlings hint if2` if you want a hint :)
|
||||||
|
|
||||||
// I AM NOT DONE
|
|
||||||
|
|
||||||
pub fn fizz_if_foo(fizzish: &str) -> &str {
|
pub fn fizz_if_foo(fizzish: &str) -> &str {
|
||||||
if fizzish == "fizz" {
|
if fizzish == "fizz" {
|
||||||
"foo"
|
"foo"
|
||||||
} else {
|
}
|
||||||
1
|
else if fizzish == "fuzz" {
|
||||||
|
"bar"
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
"baz"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue