Tips for installing Scala using SBT

You can also experiment with any Scala version using SBT. To do this, you should:

  1. Download and install SBT: https://www.scala-sbt.org/download.html.
  2. Open a Terminal and run sbt.
  3. In the SBT shell, type ++ 2.12.4 or any version you want to try. Please note that if the currently used Scala version is not binary compatible with the one you want to use, you will have to modify the command to the following—++ 2.12.4!. Binary compatibility is very important in Scala and you should try and make sure they use libraries written in the same version of Scala as they use. Otherwise, you might get into trouble.
  4. Issue the console command and you will be in a Scala shell running the version of your choice.
All the examples ...

Get Scala Design Patterns - Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.