Course of Raku / Advanced / More about built-in types / Sequences / Exercises / The last three
Solution: The last three
Here is a possible solution to the task.
Code
say (5, 10 ... 50).tail(3);🦋 You can find the source code in the file last-three.raku.
Output
(40 45 50)Comments
The seeds
5, 10set an arithmetic step of five, and the sequence runs up to its endpoint50.tail(3)returns the last three values of the finite sequence —40, 45, 50— just asheadwould return the first few.
Course navigation
← The last three | Enumerations 🆕 →