Each()
call the given UDF/Closure with every entry (key/value) in the given collection.
Status:
Each( collection=object, closure=function, parallel=boolean, maxThreads=number );
Returns: void
| Argument | Description | Default |
|---|---|---|
|
collection
object,
required
|
edit
collection to take values from |
|
|
closure
function,
required
|
edit
UDF/Closure that call with the entries from the collection
Alias: function, callback, udf |
|
|
parallel
boolean,
optional
|
edit
execute closures parallel |
|
|
maxThreads
number,
optional
|
edit
maximum number of threads executed, ignored when argument "parallel" is set to false Alias: maxThreadCount |
20 |
Examples
editfunction squareRoot(number) {
Dump(Sqr(number));
}
numbers = [16, 64, 400];
Each(numbers, squareRoot);
See also
- Collections
- Threads
- Search Issue Tracker open_in_new
- Search Lucee Test Cases open_in_new (good for further, detailed examples)