average method
Calculates the average (mean) of all numbers in the list.
Returns 0
if the list is empty.
Implementation
double average() {
return (length > 0) ? sum() / length.toDouble() : 0.0;
}
Calculates the average (mean) of all numbers in the list.
Returns 0
if the list is empty.
double average() {
return (length > 0) ? sum() / length.toDouble() : 0.0;
}