Values, Types, and Expressions
Primitive Types
Combine small integer, decimal, and boolean values.
Primitive Types
PrimitiveTypes.scala
object Main {
def main(args: Array[String]): Unit = {
val whole =
val fraction = 2.5
val aboveFive = whole > 5
val total = whole + fraction
println("whole=" + whole)
println("aboveFive=" + aboveFive)
println("total=" + total)
}
}
object Main {
def main(args: Array[String]): Unit = {
val whole =
val fraction = 2.5
val aboveFive = whole > 5
val total = whole + fraction
println("whole=" + whole)
println("aboveFive=" + aboveFive)
println("total=" + total)
}
}
object Main {
def main(args: Array[String]): Unit = {
val whole =
val fraction = 2.5
val aboveFive = whole > 5
val total = whole + fraction
println("whole=" + whole)
println("aboveFive=" + aboveFive)
println("total=" + total)
}
}
primitive-types
Basic types such as integers, doubles, and booleans carry different kinds of values through an expression.