Check out example codes for "kotlin difference between val and var". It will help you in understanding the concepts better.

Code Example 1

// Kotlin difference between val and var

// val stands for value, and cannot be changed. (immutable variable)
fun main() {
    var number = 1
}
  
// var stands for variable, and can be changed. (mutable variable)
fun main() {
    var number = 1
    number = number + 9
    println(number) // this would return 10, because number got changed
}

Learn ReactJs, React Native from akashmittal.com