[kotlin] Val and Var in Kotlin

In Kotlin, we have two types of variables: var or val. The first one, var, is a mutable reference (read-write) that can be updated after initialization. The var keyword is used to define a variable in Kotlin. It is equivalent to a normal (nonfinal) Java variable. If our variable needs to change at some time, we should declare it using the var keyword. Let's look at an example of a variable declaration:

 fun main(args: Array<String>) {
     var fruit:String = "orange"  // 1
     fruit = "banana"             // 2
 }