dgadiraju
1/22/2017 - 11:35 AM

scala-declaring-variables.scala

//Immutable
val i = 10 //Smart enough to figure out the data type
val i: Int = 0 //Data type can be defined explicitly as well
//This does not work i = i + 1, as i is defined as immutable (val)

//Mutable
var j = 20
j = j + 1