sum method
Returns the sum of all elements in the iterable.
Example:
[1, 2, 3].sum(); // 6
Implementation
num sum() {
return fold(0, (prev, el) => prev + el);
}
Returns the sum of all elements in the iterable.
Example:
[1, 2, 3].sum(); // 6
num sum() {
return fold(0, (prev, el) => prev + el);
}