Course of Raku / Advanced / Modules / Modules basics / Exercises / A shout module
Solution: A shout module
Here is a possible solution to the task. It uses two files.
Code
The module, Shouter.rakumod:
unit module Shouter;
sub shout($s) is export {
$s.uc
}The program, shout.raku:
use Shouter;
say shout('hi');🦋 You can find both source files in the exercises/advanced/modules-basics/shout-module directory.
Output
$ raku -I. shout.raku
HIComments
The
is exporttrait makesshoutvisible to any program that uses the module.The
.ucmethod returns the upper-case version of the string.