Keyboard shortcuts

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

val is immutable

object ValIsImmutable {
    def main(args:Array[String]) {
        val counter:Int = 0
        println(counter)
        counter = 1
        println(counter)
    }
}
ValIsImmutable.scala:5: error: reassignment to val
        counter = 1
                ^
one error found