Created
November 13, 2011 21:38
-
-
Save brandon-beacher/1362760 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def charity_donations_total_amount | |
charity_donations.reduce(0) do |sum, charity_donation| | |
sum + charity_donation.total_amount | |
end | |
end | |
# versus | |
def charity_donations_total_amount | |
sum = 0 | |
charity_donations.each do |charity_donation| | |
sum += charity_donation.total_amount | |
end | |
sum | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment