sum static method

double sum(
  1. Iterable<num> ns
)

Sum value of ns entries.

Implementation

static double sum(Iterable<num> ns) {
  if (ns.isEmpty) return 0;
  var total = 0.0;
  for (var n in ns) {
    total += n;
  }
  return total;
}