Course of Raku / Advanced / Subroutines / Nested subroutines / Exercises

A private helper

Problem

Write a subroutine stats that defines a nested helper subroutine double, which returns twice its argument. Inside stats, use the helper to print the value of double(3) + double(5).

Then call stats.

Example

The program prints:

16

Solution

See the solution

Course navigation

Nested subroutines   |   Solution: A private helper