Learn creative coding writing simple programs
136. Functions in SuperCollider and Processing
It would be good if you've watched episodes 19, 31, 32, 84 and 103 before this one.
Functions in SuperCollider and Processing have many differences. In this episode I compare some of those differences.
In SuperCollider, the last expression in a function is always returned, so you don't need to use the keyword "return". You also do not specify return types or argument types, so that makes the code simpler too. In many programming languages you call functions using parenthesis, like: doSomething(); In SC you use .value. For instance, f.value. One more difference is that functions do not have names, but are stored in variables. So a function is a data type, like a number or a string. This may sound confusing if you never worked with such a language (JavaScript allows this too), but don't worry. For now I just want you to recognize functions, arguments and returned values when you see them.
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); } ```