Kotlin - Collections Fundamentals
Identify the error in this Kotlin code snippet:
val data = listOf() if (data.isEmpty) { println("No data") }
val data = listOf() if (data.isEmpty) { println("No data") }
isEmpty is a function and must be called with parentheses: isEmpty().listOf() creates an empty list correctly, println syntax is correct, and mutability is not required for checking emptiness.15+ quiz questions · All difficulty levels · Free
Free Signup - Practice All Questions