Kotlin - Collections Fundamentals
Identify the error in this Kotlin code snippet:
val set = setOf(1, 2, 3) set.add(4)
val set = setOf(1, 2, 3) set.add(4)
setOf() function returns an immutable set that does not support modification.add() on a Set<T> causes a compile-time error because Set<T> has no add() method.15+ quiz questions · All difficulty levels · Free
Free Signup - Practice All Questions