Question - What is the difference between the variable declaration with var and variable declaration with val?
Answer -
The variable declaration with var and the variable declaration with val is used for different purposes. If you want to declare some mutable (changeable) variable, you should use var. If you want to declare the immutable variable, you should use val because val variables can't be changed once you have assigned them.