+ 5

(Solved) Kotlin "Identity equality for arguments of types Int and Int is deprecated"

(Edit) I figured it out. It was a wrong-operator typo in line 51. I corrected !== (not referencing the same object) to != (not having the same value). The reason it compiled with !== is because, "For values represented by primitive types at runtime (for example, Int), the === equality check is equivalent to the == check." -- https://kotlinlang.org/docs/equality.html#referential-equality Somebody at Jetbrains must have realized that giving two operators the same meaning was not best practice and deprecated it. (Old) My code compiles and runs fine, but the compiler added that interesting notice at the end of the program output. Unfortunately, Sololearn disabled line numbers from the compiler reports. Maybe someone with a separate IDE can see the line number. I suspect it's 41, 51, or both. Also, why would that be deprecated? Also, what are the recommended alternatives? A search on kotlinlang.org for the exact warning text produced zero results. https://code.sololearn.com/cb0vSnkjE02i/?ref=app

13th Jul 2023, 6:17 AM
Rain
Rain - avatar
2 ответов
+ 6
I'm glad you managed to figure out, and your post made me learn something new about Kotlin. I didn't even know about === and !== Thanks! :)
13th Jul 2023, 7:29 AM
Tibor Santa
Tibor Santa - avatar
+ 4
Tibor Santa , Really? That's cool. The social aspect is definitely the best thing about Sololearn. If the course materials are a bit shallow, the people are a bit deep.
13th Jul 2023, 7:44 AM
Rain
Rain - avatar