Scala 3 — Book

A Taste of Scala

Language

This chapter provides a whirlwind tour of the main features of the Scala 3 programming language. After this initial tour, the rest of the book provides more details on these features, and the Reference documentation provides many more details.

Setting Up Scala

Throughout this chapter, and the rest of the book, we encourage you to try out the examples by either copying them or typing them out manually. The tools necessary to follow along with the examples on your own computer can be installed by following our getting started guide.

Alternatively you can run the examples in a web browser with Scastie, a fully online editor and code-runner for Scala.

Comments

One good thing to know up front is that comments in Scala are just like comments in Java (and many other languages):

// a single line comment

/*
 * a multiline comment
 */

/**
 * also a multiline comment
 */

IDEs

The two main IDEs (integrated development environments) for Scala are:

Naming conventions

Another good thing to know is that Scala naming conventions follow the same “camel case” style as Java:

  • Class names: Person, StoreEmployee
  • Variable names: name, firstName
  • Method names: convertToInt, toUpper

More on conventions used while writing Scala code can be found in the Style Guide.

Contributors to this page: