Course of Raku / Essentials / The MAIN function / Exercises / Hello, World!

Solution: Hello, World!

After a long way through the course, we had to return to this program again, as we’ve just learnt the new way of writing Raku programs.

Code 1

sub MAIN() {
    say 'Hello, World!';
}

🦋 Find the program in the file hello-world.raku.

Code 2

unit sub MAIN;
say 'Hello, World!';

🦋 Find the program in the file hello-world-unit.raku.

Example

Run either program:

$ raku exercises/the-main-function/hello-world.raku
Hello, World!

$ raku exercises/the-main-function/hello-world-unit.raku
Hello, World!

Next exercise

💪 Print the sum

Course navigation

Built-in functions for printing / note   |