Animal Sanctuary - Error with Optional Challenge

On Step 15 of the “Animal Sanctuary” project in the “Learn Kotlin” stream. “Optional Challenge.”
I’ve completed the project successfully, but the optional challenge is to compare “Foxie” the chimp’s temperature (A Map value) to a healthy average chimp temperature (32.7)and print instructions accordingly.
I’ve declared earlier in the code
val healthyChimpTemp = 32.7

Here’s the relevant code

foxiesHealthCheck.put("temperature", 32.7)
foxiesHealthCheck.put("mood", "happy")
println("Foxie has a temperature of ${foxiesHealthCheck["temperature"]} and is feeling ${foxiesHealthCheck["mood"]}.")
if (foxiesHealthCheck["temperature"] > healthyChimpTemp) {
  println("Foxie's temperature is high. Notify the vet")
else {
    println("Foxie's health is good")

I’m getting a “receiver type mismatch” which I’ve googled, but is making my brain melt. Still getting my head around which of () [} {} is used where. Any tips super appreciated.

Erm, gotcha, kinda. What’s a [}?

Please be honest, and no offense, what level of programming wherewithal have you, coming into this project?

1 Like

Yeah I got the same problem. I assumed it was trying to compare a string with a double, so I’ve tried doing things like -

if (foxiesHealthCheck["temperature"].toDouble() > 32.7)

But that also gives a receiver type mismatch.