What is the output?
fun main() {
val x: Int? = null
val y = x ?: 10
println(y * 2)
}
Try it in the online Kotlin Playground →
[spoiler title="Solution"]
Answer:
20
Explanation:
Elvis operator provides a default when the left side is null.
[/spoiler]