
07-10-2010, 03:56 PM
|
|
Somewhat rusty
|
 |
Join Date: Mar 2001
Posts: 5,059
|
|
|
for (a: b) { ... } means that b should be an array, and the {} block is going to be executed once for every element in b, with a refering to each element in turn.
If b was an array of two sub-arrays, then the {} block would be executed twice, once with a as the first subarray and once with a as the second subarray.
: is magical as part of the for thing here, the : in ? : is something different: (a ? b : c) is an expression that is going to return b if a is true and c if a is not true. It tends to be a good idea not to use ? :.
Hope this helps. |
|
|
|