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.
Thanks
T