ABSTRACT

This chapter describes a counting loop enables us to perform two main kinds of tasks. First, a counting loop enables to count through a series of numbers. Second, a counting loop enables to repeat one or more statements a specified number of times. The chapter explains how for loops are useful for counting through sequences of numbers. It discusses how for loops are useful for repeating a set of actions a certain number of times and how a loop counter variable can be used to count upward or downward. The chapter also explains how a loop counter variable can be increased (incremented) or decreased (decremented) by one or another amount and how one for statement can be nested inside another for statement. Processing also has the ability to work with photos, and this technique of using nested for statements to step through the canvas, pixel by pixel, can be used to produce some fun and powerful photo manipulation.