completed all tasks related to if/else

This commit is contained in:
Max Boewer 2022-11-18 22:08:30 +01:00
parent 7c9577ab06
commit 81e9decacb
4 changed files with 17 additions and 4 deletions

View File

@ -1,9 +1,15 @@
// if1.rs // if1.rs
// Execute `rustlings hint if1` or use the `hint` watch subcommand for a hint. // 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 { pub fn bigger(a: i32, b: i32) -> i32 {
if a > b {
a
} else {
b
}
// Complete this function to return the bigger number! // Complete this function to return the bigger number!
// Do not use: // Do not use:
// - another function call // - another function call

View File

@ -4,13 +4,18 @@
// 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 `rustlings hint if2` or use the `hint` watch subcommand for a hint. // 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 { pub fn foo_if_fizz(fizzish: &str) -> &str {
if fizzish == "fizz" { if fizzish == "fizz" {
"foo" "foo"
}else if fizzish == "fuzz" {
"bar"
}else if fizzish == "literally anything" {
"baz"
}else { }else {
1 "1"
} }
} }

1
mypath Submodule

@ -0,0 +1 @@
Subproject commit c923e7af73a91970d2e63e03babbca9cc0817551

1
rustlings Submodule

@ -0,0 +1 @@
Subproject commit c923e7af73a91970d2e63e03babbca9cc0817551