0PricingLogin
Scala for Backend Engineering & Functional Programming · Lesson

Basic Types and Literals

Numbers, booleans, and chars.

Scala's Basic Types

Scala ships with a small set of built-in value types you will use constantly.

  • Int, Long for whole numbers
  • Double, Float for decimals
  • Boolean, Char, String

Each has a literal syntax for writing values directly in code.

Int Literals

A whole number with no decimal point is an Int by default, a 32-bit signed integer.

You can group digits with underscores for readability.

object Main extends App {
  val year = 2026
  val big = 1_000_000
  println(year + big)
}

All lessons in this course

  1. val vs var
  2. Basic Types and Literals
  3. Type Inference
  4. Expressions over Statements
← Back to Scala for Backend Engineering & Functional Programming