diff --git a/_overviews/scala3-book/methods-main-methods.md b/_overviews/scala3-book/methods-main-methods.md index 07a1f225c3..c24ce22723 100644 --- a/_overviews/scala3-book/methods-main-methods.md +++ b/_overviews/scala3-book/methods-main-methods.md @@ -14,23 +14,21 @@ Scala 3 offers a new way to define programs that can be invoked from the command @main def hello() = println("Hello, world") ``` -Just save that line of code in a file named something like *Hello.scala*---the filename doesn’t have to match the method name---and compile it with `scalac`: +Just save that line of code in a file named something like *Hello.scala*---the filename doesn’t have to match the method name---and run it with `scala`: ```bash -$ scalac Hello.scala -``` - -Then run it with `scala`: - -```bash -$ scala hello +$ scala Hello.scala Hello, world ``` A `@main` annotated method can be written either at the top-level (as shown), or inside a statically accessible object. In either case, the name of the program is in each case the name of the method, without any object prefixes. +Learn more about the `@main` annotation by reading the following sections, or by watching this video: +
+ +
### Command line arguments