On Sun, Sep 30, 2012 at 05:14:35PM -0400, Joel Matthys wrote:
I'd like to point out that "count" is a variable name, not a built-in ChucK thing. In this example, "count" is just the name someone has chosen to keep track of a number that keeps increasing by 1.
Oh, yes, that is right. Another thing is that the "*=>" operator is not some magical unique thing, but part of a larger set. So; float count; //define a float named count, by default it will be 0.0 2 => count; set it to be 2 3 +=> count; now "count" will have a value of 5 count + 3 => count; //same as the above but more typing. 2 *=> count; //also available 4 -=> count; //collect them all! 3 /=> count; //why not that one? They are free! BTW, as Joel noted; we could think here that "count" were some sort of build in thing, like "now". If you would like to be able to read code longer than this example in half a year I suggest naming stuff like this; 0 => int steps; //keeps track of the steps taken so far 16 => int max_steps; //how many steps we need to take Then you can write; while (steps < max_steps) { <<<"Stuff">>>; steps++; } Now it is clear what the variable means (what is being counted) and it will be obvious we should stop when the maximum is exceeded. For very simple things "count" or even "i" (meaning integer) is ok, of course, but if there is any doubt that it might somehow become unclear I'd name the variable after what is being counted or measured. This saves confusion and also -like here- clarifies the border between what we are doing and what ChucK has included. Naming everything "x", "y" and "z" is quick to type but it may well take a LOT more time to understand in half a year or even to find the typo in half a hour. Yours, Kas.