Reputation: 3488
What's the groovier way to do this?
def totalSightings=0; year.months.each{month-> month.weeks.each{week-> week.days.each{day-> total+=day.sightings; } } }
Upvotes: 0
Views: 54
Reputation: 635
year.months.weeks.days.sightings.flatten().sum()
Upvotes: 1