Language Reference Guide : 6. Functions : Stat Library Functions : AVERAGE Function
 
Share this page                  
AVERAGE Function
The AVERAGE function calculates the sum of the values in a list divided by the total number of items in the list. It returns the arithmetic mean.
This function has the following syntax:
AVERAGE(list = list)
Arguments
Data Type
Description
list
Array of Object (see following note)
List of items to average
Note:  The Array of Object can be an Array of FloatObject, IntegerObject, or MoneyObject.
This function returns:
Float—Average value of items in list
Null—On error
Example—AVERAGE function:
/*  Calculate the average value of digits 1 through 9
**  In the following example there is a button in the
**  frame named 'btn_calc'.
*/
intialize =
declare
digits1_9 = array of FloatObject;
j = integer not null;
enddeclare
begin
for j = 1 to 9 do
digits1_9[j].value = j;
endfor;
end
on click btn_ok =
begin
average_result = average(list = digits1_9);
end