Control structures Chapter 3
Topics Assignment statement Selection: if..else Multi-way selection: switch Repetition: p.88, 89 Functions: setup(), draw(), mousePressed()
Repetition Three kinds of loops For loop While loop Do while loop
Loops syntax While loop int i =0; while (i < 100) { do something; i = i + 1; } For loop for (int i =0; i < 100; i = i +1) {
Loops syntax (contd.) int i = 0; Do { do something; i = i + 1; } while (i < 100);
Lets apply this to drawing some shapes On to Processing: Draw 10 rectangles of different sizes and at different locations Draw 10 circles of different sizes and at different locations Parameter passing