Skip to content

Instantly share code, notes, and snippets.

@dukeimg
Last active December 10, 2015 18:58
Show Gist options
  • Save dukeimg/5ec07e70475334a831b2 to your computer and use it in GitHub Desktop.
Save dukeimg/5ec07e70475334a831b2 to your computer and use it in GitHub Desktop.
Sum of an array for @kimtoman
sum = 0
array = [1,2,3]
array.each {|a| sum+=a}
#array.each do |a|
# sum+=a
#end
puts sum #--> 6
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment