Lucee Function Reference

structreduce()

Iterates over every entry of the given struct and calls the closure with every key/value.
      This function will reduce the struct to a single value and will return this value.

Example

structreduce(struct struct,function closure,[object initialValue]):any

Category

struct,iterator

Arguments

The arguments for this function are set. You can not use other arguments except the following ones.
Name Type Required Description
struct struct  Yes struct to iterate  
closure function  Yes function/closure that implements the following constructor [function(any result, string key, object value[, struct struct]):any].  
initialValue object  No inital value passed as part of the first closure call