mirror of
https://github.com/rust-lang/rustlings.git
synced 2025-12-28 14:59:18 +00:00
Added comment for clarity
Added comment on lines 5 and 6 to explain why we changed 2.0 to 2 in the exercise.
This commit is contained in:
parent
ae444eb3da
commit
84d9a85c0d
@ -2,6 +2,8 @@ fn animal_habitat(animal: &str) -> &str {
|
||||
let identifier = if animal == "crab" {
|
||||
1
|
||||
} else if animal == "gopher" {
|
||||
// all branches of an if expression must return the same type
|
||||
// so we change from f64 to i32
|
||||
2
|
||||
} else if animal == "snake" {
|
||||
3
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user