Work in Progress

Scala 3 has not been released, yet. We are still in the process of writing the documentation for Scala 3. You can help us to improve the documentation.

Are you searching for the Scala 2 documentation?

Scala 3 — Book



In Scala 2, methods can be defined inside classes, traits, objects, case classes, and case objects. But it gets better: In Scala 3 they can also be defined outside any of those constructs with a new feature named Toplevel definitions. In short, methods can now be defined anywhere.

Many features of methods are demonstrated in the next section. Because main methods require a little more explanation, they’re described in the separate section that follows.

Contributors to this page: