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
Nik L. -
Dharmen Shah -
Ian Ndeda -
Lokesh Joshi -
Top comments (0)