BeginnerCollections
Mutable List
Add and remove items from a list.
kotlin
fun main() {
val skills = mutableListOf("Android", "Backend")
skills.add("Kotlin Multiplatform")
skills.remove("Backend")
println(skills)
}Output
[Android, Kotlin Multiplatform]
Explanation
mutableListOf creates a list you can modify. add() and remove() change its contents.