var is immutable
object VarIsMutable {
def main(args:Array[String]) {
var counter:Int = 0
println(counter)
counter = 1
println(counter)
}
}
0
1
Press ← or → to navigate between chapters
Press S or / to search in the book
Press ? to show this help
Press Esc to hide this help
object VarIsMutable {
def main(args:Array[String]) {
var counter:Int = 0
println(counter)
counter = 1
println(counter)
}
}
0
1