Values store data that later expressions can reuse.

Variables

Variables.scala
object Main {
  def main(args: Array[String]): Unit = {
    val unitPrice = 
    val quantity = 3
    val total = unitPrice * quantity

    println("unit=" + unitPrice)
    println("total=" + total)
  }
}
object Main {
  def main(args: Array[String]): Unit = {
    val unitPrice = 
    val quantity = 3
    val total = unitPrice * quantity

    println("unit=" + unitPrice)
    println("total=" + total)
  }
}
object Main {
  def main(args: Array[String]): Unit = {
    val unitPrice = 
    val quantity = 3
    val total = unitPrice * quantity

    println("unit=" + unitPrice)
    println("total=" + total)
  }
}
val Use `val` for a local value that is assigned once.