The sum of values in an array. If the array parameter value is an empty array, returns zero.
arraySum(array)
returns numeric
someArray.sum()
Name | Type | Required | Default | Description |
---|---|---|---|---|
array | array | Yes | An array name or variable name | |
ignoreEmpty | boolean | No | NO | CF2016.0.3+ Whether to ignore empty string or null values |
Uses the arraySum function to get sum of values in an array
numberArray = [10,99,27,72];
writeOutput( arraySum(numberArray));
To get sum of values in an empty array
numberArray = [];
writeOutput( arraySum(numberArray));
CF11+ Lucee4.5+ Uses the sum member function is the same as running arraySum.
numberArray = [10,99,27,72];
writeOutput( numberArray.sum() );