2 lines
124 B
Text
2 lines
124 B
Text
def seq = [1, 4, 6, 3, 7];
|
|
def sum = seq.Fold(0, _ + _); // Fold takes an initial value and a function, here the + operator
|