Skip to content

Latest commit

 

History

History
20 lines (14 loc) · 703 Bytes

methods-intro.md

File metadata and controls

20 lines (14 loc) · 703 Bytes
titletypedescriptionlanguagesnumprevious-pagenext-page
Methods
chapter
This section introduces methods in Scala 3.
ru
zh-cn
24
domain-modeling-fp
methods-most

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; we say that they are "top-level" definitions, since they are not nested in another definition. 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.

close