Course of Raku / Functional, concurrent, reactive, and web programming / Functional programming / Iterators / Exercises

Gather the multiples of three

Problem

Using gather and take, build a list of the multiples of three in the range 1..15. Take a value only when it is divisible by three. Print the list.

Example

The program prints:

[3 6 9 12 15]

Solution

See the solution

Course navigation

Solution: Gather the cubes   |   Solution: Gather the multiples of three