AVG function

AVG function

Function Name Description Usage Input parameter Return value
AVG Calculates the numerical average of all the values in an array. AVG() N/A Average of all the values in an array. The return value is of type Double.

Supported data type

The AVG function supports the following data types:

  • Double array
  • Integer array

Example 1: Calculate the average of all the values in an integer array

Sample data: $var1$ = {2,4,9,3}

Usage: $var1$.AVG()

Calculate the average of values in var1.

Output: 4.5

Example 2: Calculate the average of all the values in a double array

Sample data: $var1$ = {2.0,6.1,3.9}

Usage: $var1$.AVG()

Calculate the average of values in var1.

Output: 4.0

Recommendation