It wold be nice if Kotlin support Ternary operator. I think it is more simple that use when() or if() conditional.
Java
String username = firstName.isEmpty() ? lastName : firstName;
Kotlin
val username = firstName.isEmpty() ? lastName : firstName
It will be very good for us developers.
https://discuss.kotlinlang.org/t/ternary-operator
Let’s not get into this discussion again, as long as there is nothing new to add
Already discussed to death in other threads.
tl;dr Ain’t gonna happen. Kotlin provides more readable alternatives:
val username = if(firstName.isEmpty()) lastName else firstName
Or even better in this case:
val username = firstName?.takeUnless { it.isEmpty() } ?: lastName