Kotlin 2 · Basics and null safety
Declare variables
val is read-only and var is mutable. Types are inferred.
val name = "Ada" // read-only
var score = 0 // mutable
score += 10
Official Kotlin 2 documentation
Kotlin 2 · Basics and null safety
val is read-only and var is mutable. Types are inferred.
val name = "Ada" // read-only
var score = 0 // mutable
score += 10
Official Kotlin 2 documentation
Was this page helpful?