Course of Raku / Essentials / Scalar variables / Exercises / The answer to life, the Universe and everything

Solution: The answer to life, the Universe and everything

Here is a possible solution to the task.

Code

my $answer = 42;
say $answer;

🦋 You can find the source code in the file answer.raku.

Output

Run the program and see what it prints:

$ raku exercises/scalar-variables/answer.raku 
42

Comments

One of the requirements of this problem was to use variables. As 42 is a single value, it is a good choice to use a scalar variable to store it.

Next exercise

💪 Swap values

Course navigation

Comments / Embedded comments   |   Strings