Variables
Use val for a variable whose value never changes.
⚠️
valisn’t a constant
// String type definitionval playerName: String = "Algus Dark"
// ✘ Val cannot be reassignedplayerName = "New Name"Use var for a variable whose value can change
// 💡 When you assign an initial value the Kotlin compiler// can infer the type based on the type of the assigned value.var playerLevel = 2playerLevel = 3