Skip to content

Instantly share code, notes, and snippets.

@andersr
Created October 12, 2013 17:07
Show Gist options
  • Save andersr/6952421 to your computer and use it in GitHub Desktop.
Save andersr/6952421 to your computer and use it in GitHub Desktop.
# each
def each(array)
i = 0
until i == array.length do
yield(array[i])
i+=1
end
array
end
# collect
def collect(array)
new_array = []
i = 0
until i == array.length do
new_array << yield(array[i])
i+=1
end
new_array
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment