A variable can be considered in two parts. First its name, for instanceaand then its value, for instance,12.
In Scala, a variable also has a type, for instance,Intwhen it is an integer.
We assigned a value to the Valuea.
2and the valueaassertwhich perform a test if the sum above is equal to8Also, important things to keep in mind,valare immutable. In Scala, if you want a mutable variable, you would have to use the keywordvar.