Looping Examples M. Meyer */ /** ******************** Variables: */ // Used by the for loop int x1 = 10; // Used by the while loop int x2 = 10; /** ******************** setup(): */ void setup() { stroke(#FF0000); // Make line red. for(int i=0; i<5; i++ ) { line( x1, 10, x1, 20 ); x1 = x1 + 10; } stroke(#0000FF); // Make line blue. while ( x2 < width ) { line( x2, 30, x2, 40 ); x2 = x2 + 10; } } /** ******************** draw():

Source code: SixthProgram

Built with Processing