You can modify a “val” once it’s initialize???

Hey everyone, this might be a noob question, but then again, i’m just starting with Kotlin.

What I know/understand is that you basically have two types of variables, a val, which once initialized you cannot change

val name = “Jackson”

and a var, which you can change as needed

var name = “Jackson” var firstName = “Michael” name = firstName + name

This is understood; where I am confused is that you can create a mutable list and assign it to a val…

val names = mutableListOf(“Michael”, “Jackson”) names.add(“Presly”)

WTH, I just modified val names.

Can someone out there please shed some light on this?

Thanks.

submitted by /u/eng_manuel
[link] [comments]