Setting Up Your Environment
Prerequisites: Installing Scala
Editor
Two good choices, both free:
- Visual Studio Code with the Metals extension — Metals is the
Scala language server: autocompletion, errors as you type, go to
definition, and running
@mainmethods with one click. - IntelliJ IDEA (Community Edition) with the Scala plugin — a full IDE with refactoring and debugging.
Both understand Scala CLI files and sbt projects.
A folder for the course
mkdir scala-course
cd scala-course
code .
With Scala CLI, a single .scala file is a complete program — no
project setup needed. Run scala setup-ide . once in the folder so
Metals or IntelliJ understands it.
Formatting
scalafmt formats code consistently. Scala CLI has it built in:
scala fmt .
The REPL
The REPL (read–eval–print loop) runs Scala line by line — perfect for experiments:
$ scala repl
scala> 1 + 2
val res0: Int = 3
scala> "Scala".reverse
val res1: String = alacS
scala> :quit
The REPL shows each result's type — a great way to learn what expressions return.