Course of Raku / Advanced / Modules / Modules basics / Exercises

A maths module

Problem

Create a module named Maths, in a file Maths.rakumod, that exports a subroutine square returning the square of its argument.

Then write a separate program that uses the module to print square(6).

Example

Run with the module on the search path, the program prints:

$ raku -I. maths.raku
36

Solution

See the solution

Course navigation

Quiz — Export tags   |   Solution: A maths module