Skip to content

librity/learning_scala

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Learning Scala

All my Scala tutorials.

Install on Linux

Install with Coursier (cs), Scala's npm:

$ curl -fL https://github.com/coursier/launchers/raw/master/cs-x86_64-pc-linux.gz | gzip -d > cs && chmod +x cs && ./cs setup

Tools

  • cs: Coursier, package manager
  • scalac: the Scala compiler
  • scala: the Scala REPL and script runner
  • scala-cli: Scala CLI, interactive toolkit for Scala
  • sbt & sbtn: The sbt build tool
  • amm: Ammonite is an enhanced REPL
  • scalafmt: Scalafmt is the Scala code formatter

Installing/Switching Versions

$ cs launch scala:2.13.10
$ cs launch scalac:2.13.10
$ cs install scala:2.13.10 scalac:2.13.10

Hello World!

# Create Scala 3 project
sbt new scala/scala3.g8
# OR Create Scala 2 project
sbt new scala/hello-world.g8

Then type project name. You can compile, run or test it with:

$ cd hello_world
$ sbt compile
$ sbt run
$ sbt console
$ sbt test
$ sbt clean

IDE

VSCode:

IntelliJ IDEA