ArrayAvg()
Calculates the average of the values in an array. All elements in the array must contain values that can be automatically converted to numeric.
ArrayAvg( array=array );
Returns: Number
| Argument | Description |
|---|---|
|
array
array,
required
|
edit
The array to calculate the average values from |
Examples
editnumbers = [ 1, 2, 3, 4 ];
avgValue = ArrayAvg( numbers );
Echo( avgValue ); // outputs 2.5
See also
- Arrays
- array.avg()
- Search Issue Tracker open_in_new
- Search Lucee Test Cases open_in_new (good for further, detailed examples)