Scala - Getting Started (Hello World)

About

Getting started page with an HelloWorld example and some documentation.

Hello World

object HelloWorld {
  def main(args: Array[String]): Unit = {
    println("Hello, world!")
  }
}

Maven

In a maven project, you need to add the lang library

<dependency>
	<groupId>org.scala-lang</groupId>
	<artifactId>scala-library</artifactId>
	<version>${scala.version}</version>
</dependency>

but there is other library:

<dependency>
	<groupId>org.scala-lang</groupId>
	<artifactId>scala-compiler</artifactId>
	<version>${scala.version}</version>
</dependency>
<dependency>
	<groupId>org.scala-lang</groupId>
	<artifactId>scala-reflect</artifactId>
	<version>${scala.version}</version>
</dependency>
<dependency>
	<groupId>org.scala-lang</groupId>
	<artifactId>scala-actors</artifactId>
	<version>${scala.version}</version>
</dependency>
<dependency>
	<groupId>org.scala-lang.modules</groupId>
	<artifactId>scala-parser-combinators_${scala.binary.version}</artifactId>
	<version>1.0.4</version>
</dependency>

where:

<properties>
        <scala.binary.version>2.11</scala.binary.version>
        <scala.version>2.11.8</scala.version>
</properties>

Documentation / Reference

Beginner

Advanced


Powered by ComboStrap