2 The Scala environment

 

After reading this lesson, you’ll be able to

  • Execute commands on the Scala REPL
  • Use the REPL to evaluate expressions
  • Install the git and docker development tools

The Scala REPL (Read-Eval-Print-Loop) is a development tool to interpret Scala code snippets. It will be a crucial tool in learning Scala, and it doesn’t require too much setup or infrastructure: you’ll be able to play and experiment with the language by typing and evaluating fragments of code. You’ll also install the git and docker development tools on your machine, which are not specific to Scala but used in some of the more advanced capstones. In the next lesson, you’ll complete your machine’s setup by installing sbt—a tool to build and run structured Scala programs.

2.1 The REPL installation

In this section, you’ll learn how to install the Scala REPL on Linux, macOS, and Windows using a package manager. Alternatively, you can also download Scala binaries from its official website (visit https://scala-lang.org/download and its “Download the Scala binaries” section for instructions on how to do this).

First, you need to check that you have installed Java 8+ JDK. Open the terminal and type the command java -version to check your java version. You should see a message similar to the following:

$ java –version
openjdk version "15.0.1" 2020-10-20
OpenJDK Runtime Environment (build 15.0.1+9-18)
OpenJDK 64-Bit Server VM (build 15.0.1+9-18, mixed mode, sharing)

2.2 The REPL commands

2.3 The REPL code evaluation

2.4 Other development tools

2.4.1 Git installation

2.4.2 Docker installation

Summary

sitemap