Loops using arrays



color[] c = new color[3];
int x;

void setup() {
  size(400, 400);
  c[0]=color(255, 0, 0); // first color
  c[1]=color(0, 255, 0); // second
  c[2]=color(0, 0, 255); // third
}

void draw() {

  int j = 20;
  x = 0;

  for (int i = 40; i <= 500; i = i+80 ) {
    fill(c[x]);
    ellipse(i, 100, 30, 80);
    x = x + 1;
    if (x>2) { 
      x=0;
    }//if
  }//for
}//func