Course of Raku / Advanced / Modules / Packages and namespaces 🆕 / Exercises

A nested name

Problem

Nest a module Inner inside a module Outer. Inside Inner, declare an our variable $base set to 10 and an our sub doubled that returns $base multiplied by two. From outside both modules, reach the variable through its full nested name and call the subroutine through its full nested name. Print both results.

Example

The program prints:

10
20

Solution

See the solution

Course navigation

Solution: A package   |   Solution: A nested name