klyn.Application.sum
method
public static sum<T extends AbstractNumber>(values as Set<T>) as T:
Description

Returns the sum of all numeric values from a set.

Empty sets return 0 converted to the set item type.

ints = {10, 20, 30}
print(sum(ints))   # 60

doubles = {10.1, 20.2, 30.3}
print(sum(doubles))   # 60.6
Parameters
  • values The set to sum.
Returns

The accumulated total with the same numeric type as the set items.