Learn to Program with ZedLX

Free Online Programming Course for Beginners

Arrays [6/11]

The elements of an array can be of type color.

In this example, the for loop is used to draw a series of discs, each with a color from the array. Note that, in the disc procedure call, the color value is selected from the array by an index operator.

Exercise:

  1. Modify the for loop to count backwards, so that the discs are drawn in reverse order.

Solution

for #i = a.n .. 1  --

Loading...