LSP- Review Lesson

Review Lesson

Aside from the draw() method, there are two main loops that we use in Processing: the "while" loop and the "for" loop. Both loops can be used to perform similar tasks, though some problems are easier to solve using one loop over another. In general, we use the while loop for an indeterminate range - we don't know how many times we want to do something. In general, we use the for loop for a determined range - we know we want to do something 'n' times or a counted number of times. When we use the for loop inside draw () it acts as a loop inside a loop. Processing provides a noLoop() function that can be used to control the flow of the program. Both a for and a while loop have three parts; initializing value, condition, and a step.   A nested for loop is used to create rows and columns.  The first for loop is called the outer loop and the second for loop is called the inner loop.  The outer loop controls how many times the inner loop will repeat.  

Review Activity

[CC BY 4.0] UNLESS OTHERWISE NOTED | IMAGES: LICENSED AND USED ACCORDING TO TERMS OF SUBSCRIPTION