Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.
There is one last core programming concept you’ll need to in order to call yourself a coder: the loop. After that, we’re finished, I promise. The ability to take a single instruction or group of instructions and repeat it hundreds, thousands, or millions of times is a key advantage of programmatic drawing over any other comparable creative process. This is a very straightforward way to scale ideas.
You have already encountered one working loop in the previous examples: the frame loop. The chunk of code within the draw() function is called every time a new frame is entered, so the code is executed repeatedly for as long as the program is running. You can use this to perform repeating actions if you want, but this isn’t the only loop available to you. You can code your own loops, too.