Iterates over every entry of the collection and calls the closure with every element.
This function will reduce the array to a single value and will return the value.
Lucee Function Reference
Function COLLECTIONREDUCE
Example
collectionreduce(object collection,function closure,[object initalValue]):any
Arguments
The arguments for this function are set. You can not use other arguments except the following ones.
Name | Type | Required | Description |
---|---|---|---|
collection | object | Yes | collection to iterate |
closure | function | Yes | function/closure that implements the following constructor [function(... depending on the given collection ...):any]. |
initalValue | object | No | inital value passed as part of the first closure call |