The Difference {}, () in kotlin null check
I'm practicing null checking in kotlin
When I use Elvis operator ?:
I use {} but the correct way is using ().
But My mistake, the result was wrong.
My Mistake Codes are below.
var name: String = "eunno"//NonNull
val lastName: String? = null
val fullName = name + " " + {lastName ?: "No lastName"}
Result when use {}
eunno Function0
Result when use ()
eunno No lastName
I don't understand the difference of results.
Is there any difference about using {}, ()?