size(200,200);
background(255);
for (________; _________; ________–20)  {
  stroke(0);
  fill(________);
  ellipse(________,________,________,________);
}
Example
// Learning Processing
// Daniel Shiffman
// http://www.learningprocessing.com

// Exercise 6-2b: Rewrite Exercise 6-1b using a for loop.

void setup(){
  size(200,200);
  smooth();
}

void draw(){
  background(255);
  for (float w = width; w > 0; w = w - 20) {
    stroke(0);
    fill(w);
    ellipse(width/2,height/2,w,w);
  }
}
  • Guest

    In the book is a mistake showing 2 lines for ellipse which was confusing ;-)

  • Anonymous

    thanks, will make sure this is corrected!

  • Awais_5112

    void setup(){
      size(400,400);
      background(120,180,60);
    }

    void draw(){
    int x=5;
    int dy=10;
    int dx=385;
    for(int y=5; y<=385; y+=dy)
    {line(x,y,x+dx,y);
    }

    }

  • Awais_5112

    sorry this is for exercise 6-2 (b), have posted by mistaken