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)
}
}