Skip to main content

reduce

Folds the elements into one value; the running total is #acc and the element is #

reduce(arr: array, expression: closure, initial: any) -> any

Arguments

NameType
arrarray
expressionclosure
initialany

Example

{{ reduce([1, 2, 3], #acc + #, 0) }}

Returns 6.