Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions exercises/03_if/if3.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
fn animal_habitat(animal: &str) -> &str {
// TODO: Fix the compiler error in the statement below.
//
// Hint: every `if` / `else if` / `else` branch must produce the same type.
// A floating-point literal, a string, and integers cannot be mixed in one chain.
// For unknown animals, use another integer identifier (for example `4`) instead of
// a string, then keep the habitat checks below unchanged.
let identifier = if animal == "crab" {
1
} else if animal == "gopher" {
Expand Down
Loading