Chapter 7. Functions
“When it’s all mixed up, better break it down.”
|--—Tears for Fears|
In this chapter:
Declaring and defining a function.
Calling a function.
Returning a value.
Break it down
The examples provided in Chapters 1 through 6 are short. We probably have not looked at a sketch with more than 100 lines of code. These programs are the equivalent of writing the opening paragraph of this chapter, as opposed to the whole chapter itself.
Processing is great because we can make interesting visual sketches with small amounts of code. But as we move forward to looking at more complex projects, such as network applications or image processing programs, we will start to have hundreds of lines of code. We will ...