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

Consumes a numeric generator and closes it on every exit.

Parameters
ParameterDescription
valuesSingle-pass sequence to sum.
Returns

Sum of the yielded values, or the zero value of T when empty.

Throws
  • NullException if values is null at runtime; a statically null argument is rejected at compilation with TypeError.
Example

assert sum(range(10)) == 45