Excercise 6 – 2

Using a FOR Loop to draw a series of lines

code


size(200,200);
background(255);

for (int y = 0; y <= height; y+=10) // this for loop initialized y as 0 // and as long as y is less than or equal to the height // it increments y by 10 pixels on each cycle through the "for" loop { stroke(0); // set stroke to black line(0,y,width,y); // make a line that is the width of the canvas print("cycle "); // print cycle below so we can see what's happening } // end of "for" loop, then go and cycle again until the conditions change