Learn creative coding writing simple programs

103. Functions help keep code organized

When you start writing longer programs they can become difficult to follow. It's important to learn how to keep them easy to understand and easy to modify. There are different techniques for doing that. Some of them involve subdividing programs in smaller, easier to manage blocks.
In this episode we take a look at how we can use functions to subdivide programs into smaller parts. A function usually should not have much more than 15 or 20 lines. If it does, then maybe it's time to break it down.

Tags: functions

Code editor

You can make changes to the code below. Then
Reference

Questions and comments

Try to stay close to the topic of this episode. Use the Processing forums for help with unrelated Processing projects (or hire me for help ;-)

To indicate that a word in your comment is code, use the `backtick`. Example
  Do `float` and `int` smell similar?
To highlight code blocks, use ```processing and ``` like this:
  ```processing
  void setup() {
    size(600, 600);
  }
  ```