Course of Raku / Essentials / More about types / Positional data types / Exercises

Odd indices

Problem

You have an array of numbers:

my @data = 10, 12, 1, 5, -9, 8, 36, 18, 21;

Complete the program to print only the elements with odd indices. Make sure the program still works if you change the number of items in @data.

Example

$ raku odd-indices.raku
12
5
8
18

Solution

See the solution

Course navigation

Solution: Months names   |   Solution: Odd indices

Translations of this page: EnglishDeutschEspañolItalianoLatviešuNederlandsБългарскиРусскийУкраїнська