Skip to content

Instantly share code, notes, and snippets.

@xander-miller
Created March 2, 2014 16:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save xander-miller/9308806 to your computer and use it in GitHub Desktop.
Save xander-miller/9308806 to your computer and use it in GitHub Desktop.
Sheldon's exercise
class Array
def sum
sum = 0
self.each do |item|
#some code
end
sum
end
def add_index
item_with_index_array = []
self.each_with_index do |item, index|
#some code
end
item_with_index_array
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment