+ 1
What is difference between var and Val.
2 Respuestas
+ 2
This is what I found for you from internet
"var is like a general variable and can be assigned multiple times and is known as the mutable variable in Kotlin. Whereas val is a constant variable and can not be assigned multiple times and can be Initialized only single time and is known as the immutable variable in Kotlin."
The original website
https://medium.com/mindorks/kotlin-series-val-vs-var-difference-android-kotlin-ecad780daeb7
+ 2
The word val stands for constant value let say you have 1 value
val x:Int = 6
this 6 can not be changed(reassigned)
Which means you will get error when you try to reassigned or chane the value x = 7//error
But var stands for variable as its name it's name it can be changed every where I.e var n : Int = 10
Then
n = 15//it can be changed every where