Kotlin - Collections Fundamentals
Find the error in this Kotlin code:
val map = mapOf("a" to 1)
val value = map.getValue("b") ?: 0
println(value)val map = mapOf("a" to 1)
val value = map.getValue("b") ?: 0
println(value)getValue(key) throws NoSuchElementException if the key is not present in the map.?: is not reached because exception is thrown before it can be applied.15+ quiz questions · All difficulty levels · Free
Free Signup - Practice All Questions