From 1ffce4f42ce5b5f655653db01447c6dfe6b6393f Mon Sep 17 00:00:00 2001 From: Julien Richard-Foy Date: Thu, 7 Jul 2022 13:59:48 +0200 Subject: [PATCH] Embed video about program entry points --- _overviews/scala3-book/methods-main-methods.md | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) 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