Lists
Immutable lists with listOf, mutable lists with mutableListOf; element access and size.
Simple enough for a 5-year-old to understand
Create and access a list
listOf produces an immutable list. Elements are accessed using index numbers starting from zero.
val colors = listOf("red", "purple", "green")println(colors[0])println(colors.size)🎯 Exercise & Practice
Test what you've learned — answer, write code, check instantly. (1 left)