I want to follow the book on Scala[1] but it uses Scala 3 and I have Scala 2 installed. I want to use both the versions, something on the lines of python2 and python3.
I tried installing Scala3 on my local using the official source but I could only grasp the project-level working directory. The sbt prompt does not work like a REPL would and I can only open REPL using Scala 2 (I checked the version everytime).
How do I open the REPL of Scala3 given I cannot uninstall Scala2?
If you execute
sbt consolefrom within project directory it will drop you into REPL version corresponding to the project'sscalaVersion. For example, executingsbt consolewithin project created withsbt new lampepfl/dotty.g8would start Scala 3 REPL.For system-wide installation first install coursier and then execute
cs install scala3-repl. This will install Scala 3 REPL alongside the Scala 2 one. Now Scala 3 REPL can be started withscala3-replcommand whilst Scala 2 REPL simply withscalacommand.