[Solved] What is the difference between two line of code in Kotlin?


== operator is used to check whether the contents of 2 variables match example the user.id and it.id in your code.

!= is used when we want to check whether the contents do not match they are opposite to each other.

Update after edit
Assuming the users is a list or one of the kotlin collection the first LOC finds the first user from the collection that has same id as userId then if there is such a user ie the ? returns some object then gets the name of same.

The second LOC has a condition that is exactly opposite it finds the first user that does not have the same id and provides its name.

1

solved What is the difference between two line of code in Kotlin?