Skip to content
RED SAGSkills
easy5 pts · first answer countskotlinkotlin-basics

Kotlin val with a mutable list

What does this Kotlin code print, and would the commented-out line compile if you removed the '//'?

val items = mutableListOf(1, 2)
items.add(3)
// items = mutableListOf(4)
println(items)
Choose one answer

Discussion 0

Join free to post in the discussion.

Related questions