ArrayAvg

Return length of array

Method Signature

ArrayAvg(array=[Array])

Arguments

Argument
Type
Required
Description
Default

array

Array

true

The array whose elements will be averaged.

Examples

Average value of an array

Uses the arrayAvg function to get average value of an array

Run Example

numberArray = [ 
	1,
	2,
	3
];
writeOutput( arrayAvg( numberArray ) );

Result: 2

Average value of an array using the Array member function

Uses the avg member function is the same as running arrayAvg.

Run Example

numberArray = [ 
	1,
	2,
	3
];
writeOutput( numberArray.avg() );

Result: 2

Additional Examples

Run Example

numbers = [ 
	1,
	2,
	3,
	4
];
avgValue = ArrayAvg( numbers );
Echo( avgValue );
 // outputs 2.5

Last updated

Was this helpful?