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

Run Example

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

Run Example

numberArray = [];
writeOutput( arraySum( numberArray ) );

Result: 0

Sum of values in an array

Uses the sum member function is the same as running arraySum.

Run Example

numberArray = [ 
	10,
	99,
	27,
	72
];
writeOutput( numberArray.sum() );

Result: 208

Additional Examples

Run Example

numberArray = [ 
	10,
	99,
	27,
	72
];
dump( arraySum( numberArray ) );
// member function
dump( numberArray.sum() );

Last updated

Was this helpful?