ArraySum
Returns the sum of all values in an array
Method Signature
ArraySum(array=[array])
Arguments
Argument
Type
Required
Description
Default
array
array
true
Examples
Sum of values in an array
Uses the arraySum function to get sum of values in an array
numberArray = [
10,
99,
27,
72
];
writeOutput( arraySum( numberArray ) );
Result: 208
Sum of values in an array
To get sum of values in an empty array
numberArray = [];
writeOutput( arraySum( numberArray ) );
Result: 0
Sum of values in an array
Uses the sum member function is the same as running arraySum.
numberArray = [
10,
99,
27,
72
];
writeOutput( numberArray.sum() );
Result: 208
Additional Examples
numberArray = [
10,
99,
27,
72
];
dump( arraySum( numberArray ) );
// member function
dump( numberArray.sum() );
Related
Last updated
Was this helpful?