Each

call the given UDF/Closure with every entry (key/value) in the given collection.

Returns: void

Usage

Each( collection, closure [, parallel [, maxThreads ] ] )

Arguments

Argument Description Default
collection
(object, required)

collection to take values from

closure
(function, required)

UDF/Closure that call with the entries from struct

parallel
(boolean, optional)

execute closures parallel

maxThreads
(number, optional)

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

20

Examples

function squareRoot(number) {
  Dump(Sqr(number));
}

numbers = [16, 64, 400];
Each(numbers, squareRoot);

See also