What is the simplest way to output every nth element of an array?

I can do it using a for loop:
void main()
{
    int[5] a = [1,2,3,4,5];

    for (int i = 0 ; i <= 4 ; i += 2)
    {
        writeln(a[i]);
    }
}

Basically, I am wondering if I missed something.

Reply via email to