List.metaClass.avg = {
return delegate.size() ? delegate.sum() / delegate.size() : 0
}
Use:
assert [1, 2, 3].avg() == 2
List.metaClass.avg = {
return delegate.size() ? delegate.sum() / delegate.size() : 0
}
Use:
assert [1, 2, 3].avg() == 2
For further actions, you may consider blocking this person and/or reporting abuse
Hrish B -
Tiioluwani -
Zaba Va -
Hexadecimal -
Top comments (0)