Skip to content

Instantly share code, notes, and snippets.

@kranthilakum
Last active November 10, 2022 09:05
Show Gist options
  • Save kranthilakum/2d06310b97f4c36248d5202a54b011b3 to your computer and use it in GitHub Desktop.
Save kranthilakum/2d06310b97f4c36248d5202a54b011b3 to your computer and use it in GitHub Desktop.
Use SDK manager to install scala

Install scala

$ sdk install scala

Downloading: scala 3.2.0

In progress...

########################################################################################################################## 100.0%

Installing: scala 3.2.0
Done installing!

$ sdk current scala

Not using any version of scala 

$ sdk use scala 3.2.0
Setting scala version 3.2.0 as default.

Using scala version 3.2.0 in this shell.

Restart the terminal

$ scala -version
Scala code runner version 3.2.0 -- Copyright 2002-2022, LAMP/EPFL

Check SBT version

sbt about
copying runtime jar...
[info] Updated file /Users/qvantel/project/build.properties: set sbt.version to 1.5.7
[info] welcome to sbt 1.5.7 (Eclipse Adoptium Java 11.0.17)
[info] loading project definition from /Users/qvantel/project
[info] set current project to qvantel (in build file:/Users/qvantel/)
[info] This is sbt 1.5.7
[info] The current project is ProjectRef(uri("file:/Users/qvantel/"), "qvantel") 0.1.0-SNAPSHOT
[info] The current project is built against Scala 2.12.14
[info] Available Plugins
[info]  - sbt.ScriptedPlugin
[info]  - sbt.plugins.CorePlugin
[info]  - sbt.plugins.Giter8TemplatePlugin
[info]  - sbt.plugins.IvyPlugin
[info]  - sbt.plugins.JUnitXmlReportPlugin
[info]  - sbt.plugins.JvmPlugin
[info]  - sbt.plugins.MiniDependencyTreePlugin
[info]  - sbt.plugins.SbtPlugin
[info]  - sbt.plugins.SemanticdbPlugin
[info] sbt, sbt plugins, and build definitions are using Scala 2.12.14

Open scala REPL

scala
Welcome to Scala 3.2.0 (11.0.17, Java OpenJDK 64-Bit Server VM).
Type in expressions for evaluation. Or try :help.
                                                                                                                               
scala> 1 + 1
val res0: Int = 2
                                                                                                                               
scala> res0 * 3.0
val res1: Double = 6.0

scala> val x = 42
val x: Int = 42

scala> import scala.math._
                                                                                                                               
scala> pow(x, 3)
val res2: Double = 74088.0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment