Skip to content

Commit b186740

Browse files
authored
Merge pull request #2465 from scalacenter/entry-points-video
Embed video about program entry points
2 parents 2c54b3f + 1ffce4f commit b186740

File tree

1 file changed

+6
-8
lines changed

1 file changed

+6
-8
lines changed

_overviews/scala3-book/methods-main-methods.md

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -14,23 +14,21 @@ Scala 3 offers a new way to define programs that can be invoked from the command
1414
@main def hello() = println("Hello, world")
1515
```
1616

17-
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`:
17+
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`:
1818

1919
```bash
20-
$ scalac Hello.scala
21-
```
22-
23-
Then run it with `scala`:
24-
25-
```bash
26-
$ scala hello
20+
$ scala Hello.scala
2721
Hello, world
2822
```
2923

3024
A `@main` annotated method can be written either at the top-level (as shown), or inside a statically accessible object.
3125
In either case, the name of the program is in each case the name of the method, without any object prefixes.
3226

27+
Learn more about the `@main` annotation by reading the following sections, or by watching this video:
3328

29+
<div style="text-align: center">
30+
<iframe width="560" height="315" src="https://www.youtube.com/embed/uVMGPrH5_Uc" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>
31+
</div>
3432

3533
### Command line arguments
3634

0 commit comments

Comments
 (0)