One of things that computers are great at is repetition. Imagine having to create a thousand shapes onscreen with varying parameters. It would take us an unreasonable amount of time to do so with our current programming knowledge. For this kind of case where we want to repeat our code as it is or with variations, we can leverage a programming structure called loops. A loop allows us to execute a block of code over and over again.
We are already familiar with the idea of a loop in p5.js. If you think about it, the draw function is a continuous loop that gets executed over and over again until we ...