ArrayEach

call the given UDF/Closure with every value in the array.

ArrayEach( array, closure [, parallel [, maxThreads ] ] )

Returns: void

Argument Description Default
array
array, required

array to take values from

closure
function, required

A closure function (UDF) with the following signature:

function(el, ix, arr){}

Which is called for each item in the array.

Where el is the element (or item) of the array, ix is the index position of that element, and arr is a reference to the base array upon which the arrayEach function is called.

parallel
boolean, optional

execute closures parallel

maxThreads
number, optional

maximum number of threads executed, ignored when argument "parallel" is set to false

20

Examples

aNames = array("Marcus","Sarah","Josefine");
arrayEach(
    aNames,
    function(element){
        dump(var="#ucase(element)#",label="ucase element");
    }
);
//member function version
aNames.each(
    function(element){
        dump(var="#lcase(element)#",label="lcase element");
    }
);

See also