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.

Tags: supercollider, function, argument, return

Code editor

You can make changes to the code below. Then
Below you can ask and answer questions related to this video. If your question is unrelated to the video, please post it at the Processing Forum as I'm unable to help with all of your programs and still have enough free time to eat and sleep :)
comments powered by Disqus