Learn creative coding writing simple programs

19. Tweak the bar-code, create your first function

This time we continue with the bar-code example from last episode. We create our first custom function. Functions can make the code easier to read. They are also useful to avoid repeating code: when the same group of lines is used multiple times in a program, it's a good idea to convert that group of lines into a function.
We also play a little bit with the numbers to see how they affect the image.

Tags:

Code editor

You can make changes to the code below. Then

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);
  }
  ```