0PricingLogin
Scala for Backend Engineering & Functional Programming · Lesson

Using the REPL

Interactive Scala.

What Is the REPL?

The REPL stands for Read-Eval-Print Loop. It is an interactive shell where you type Scala expressions and immediately see their results.

You start it by running scala (or scala-cli repl) in your terminal. It is the fastest way to experiment with the language without writing a whole program.

Your First Expression

Type any expression and press Enter. The REPL evaluates it and prints the result, its type, and a generated name.

For example, typing 1 + 1 shows something like val res0: Int = 2.

object Main {
  def main(args: Array[String]): Unit = {
    println(1 + 1)
  }
}

All lessons in this course

  1. Using the REPL
  2. val, var and Types
  3. Expressions over Statements
  4. String Interpolation
← Back to Scala for Backend Engineering & Functional Programming