How can i resolve 'val cannot be reassigned' in kotlin?

In Kotlin, variables declared with `val` are read-only and cannot be reassigned. This error occurs when trying to modify them.


val number: Int = 10
number = 20


var number: Int = 10
number = 20
If you need a mutable variable, use `var` instead of `val`.

Beginner's Guide to Kotlin