Open
Description
I think 03_if/if3.rs
is a bit ambiguous. The code to be modified looks like this:
// TODO: Fix the compiler error in the statement below.
let identifier = if animal == "crab" {
1
} else if animal == "gopher" {
2.0
} else if animal == "snake" {
3
} else {
"Unknown"
};
which is intuitively indicating to change "Unknown" to an unused identifier, however it still won't work because the compiler will continue prompting for changes until 2.0
is replaced with 2
.
Personally it took me a while to figure it out, and that's not the problem, but when I checked the official solution:
let identifier = if animal == "crab" {
1
} else if animal == "gopher" {
2
} else if animal == "snake" {
3
} else {
// Any unused identifier.
4
};
the only change mentioned is from Unknown
to 4
, but there's no explanation that 2.0
must also be changed to 2
. I think adding a comment to clarify the necessary type consistency would be very helpful.
Metadata
Metadata
Assignees
Labels
No labels