Description:-

This is used to calculate the sum of the values of an array. this will return the sum value. If the array parameter value is an empty array, then it returns zero.

arraySum( array [, parallel] [, maxThreadCount] );

Member Function Syntax

array.sum( );

Attributes:-

array:- This is a required argument, the name of the array object.

ignoreEmpty:- This is a non-required attribute, this is a boolean argument, and the default value is false.

parallel:- This is a non-required attribute, the default value is false, set as true if the items can be executed in parallel.

maxThreads:- This is a non-required attribute, the number of threads the function can execute. The number of threads must be between 1-50. If the value exceeds 50, there is an exception.

Example:-

newArray = [ 9, 18, 43, 62, 77 ];
writeOutput( arraySum( newArray ) );

Result:-

209

Example – using the ignoreEmpty parameter

newArray = [ 9, 18, 43, 62, 77 ];
writeOutput( arraySum( newArray, true ) );

Result:-

209

Example – using the member function

newArray = [ 9, 18, 43, 62, 77 ];
writeOutput( newArray.sum( ) );

Result:-

209