Skip to content

Commit

Permalink
if exercises completed
Browse files Browse the repository at this point in the history
  • Loading branch information
Joaopmorais committed Feb 16, 2024
1 parent 438ac65 commit 6f05a05
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 11 deletions.
10 changes: 5 additions & 5 deletions exercises/03_if/if1.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@
//
// 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){
b
} else {
a
}
}

// Don't mind this for now :)
Expand Down
7 changes: 4 additions & 3 deletions exercises/03_if/if2.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,14 @@
//
// 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 {
1
} else if fizzish == "fuzz"{
"bar"
} else{
"baz"
}
}

Expand Down
5 changes: 2 additions & 3 deletions exercises/03_if/if3.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,16 @@
//
// Execute `rustlings hint if3` or use the `hint` watch subcommand for a hint.

// I AM NOT 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"
4
};

// DO NOT CHANGE THIS STATEMENT BELOW
Expand Down

0 comments on commit 6f05a05

Please sign in to comment.