Product SiteDocumentation Site

11.3.7.2. "Do This, This Many Times"

Another way to write a "do" loop takes advantage of SuperCollider's flexibility, and is really the same as one of the methods above. It's basically equivalent to telling the interpreter to "run this Function this many times." The syntax looks like this,

aNumber.do(aFunction(number));

This causes aFunction to be execute aNumber times. The interpreter still provdies two arguments to aFunction, but they are the same: it is the integers from zero to one less than aNumber. You might also think of it as the number of times that aFunction has been executed prior to this particular execution.