Variables And Values

If you want a deeper guide to Scala, when I was learning I used Programming Scala and Scala for Data Science.

Values Are Immutable

// Create a value called greeting that is a string with the word "Hello"
val greeting: String = "Hello"

// View the value
greeting
Hello

Variables Are Mutable

// Create a variable called age that is a "short" number (between -32768 to 32767) with the number 12
var age: Short = 12

// View the variable
age
12