Installation
- using sdkman, get list of scala available for installation
sdk list scala - to install scala
sdk install scala - to check version
scala --version
Getting Started
Using Scala REPL
Scala’s REPL (Read-Eval-Print Loop) is perfect for experimentation:
|
|
Here is an example of using the REPL:
|
|
Using Text Editor
- using any text editor of your choice, create a new file with the extension
.scala - write your scala code in the file
- save the file
- to run the scala code, type
scala <filename.scala>in the terminal - example:
1 2 3 4 5 6mw@mac scratch % cat Hello.scala object Hello { def main(args: Array[String]): Unit = { println("Hello Scala") } }