Kotlin: using elvis operator
Example:
val name: String? = null
The Elvis operator provides a shorthand to handle nullable types.
Solution:
val length = name?.length ?: 0
Example: Solution:Kotlin: using elvis operator
The Elvis operator provides a shorthand to handle nullable types.
val name: String? = null
val length = name?.length ?: 0