Mascara Try it Download Buy About Documentation Blog

for each-loops

A for each loop iterates over the values of an array or object.

Syntax definition [Help]
for each ( var name in expression) {
    statements...
}

For example:

var list = ["a","b","c"];
for each (var val in list) {
   write(val);
}
Writes "abc".

This is different from for-in-loops, which iterates over the properties or indices rather than the values.

For-each-in can also be used in array comprehensions.