Course of Raku / Advanced / Modules / Modules basics / Exercises / Read the constant
Solution: Read the constant
Here is a possible solution to the task.
Code
The program, read-pi.raku:
need Circle;
say $Circle::pi;🦋 You can find both source files in the exercises/advanced/modules-basics/read-the-constant directory.
Output
$ raku -I. read-pi.raku
3.14Comments
need Circleloads the module but does not import any names, so a bare$piwould not be recognised.The
ourvariable is reached through the module’s name, written as$Circle::pi.