The var & val Of Kotlin
The Var and Val of Kotlin There can be many versions of understanding for this topic depending on how you imply to use them. Lets start with basics. Now apparently we tend to somehow understand that names are given for a reason. In our case here it is 'var' & 'val'. 'Var' can be referred as variables. Now variables as names suggest can be varying in your code journey starting to end. I hope all this is making some sense here. Coming to 'val' that can be referred as value. Now this will not change, throughout the code value will be same. According to the supporting document, var is mutable sure, but that does not imply val is immutable. In more simple words, 'val' is read-only variable. What happens if you try to change the value of 'val' variable? fun main(args: Array<String>) { val marksInMaths = 74 print("Scored Marks in Mathematics : "+marksInMaths) //now change the value m