Course of Raku / Objects, I/O, and exceptions / Classes and objects / Subroutines vs methods / Exercises

Triple as a subroutine

Problem

Write a subroutine triple that returns three times its argument. Call it with 7 and print the result.

Example

The program prints:

21

Solution

See the solution

Course navigation

Subroutines vs methods   |   Solution: Triple as a subroutine