Learn creative coding writing simple programs
31. Function parameters and return values
This episode is a bit more serious and less visual, but it will be important to know how to create your own functions.
We create a simple function that does not take any parameters, and another that takes two numeric parameters and adds them together. We also create a function that returns a value.
Knowing this we will be able to simplify the program we created in the previous episode with four rotating rectangles.
Code editor
You can make changes to the code below. Then
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, surround it with ``` code-fences ``` like this:``` void setup() { size(600, 600); } ```