Why would one be there?
val / var is about being able to edit the reference to an object, List being Mutable or read-only is about being change the contents of the object referenced.
var list = listOf() works as well
Its youtube video
So val l1 = mutableListOf(1, 2, 3) l1.append(4) but var l2 = listOf(1, 2, 3) l2 = listOf(4, 5, 6)
Обсуждают сегодня