Skip to content

Instantly share code, notes, and snippets.

@telegraham
Created September 17, 2018 22:26
Show Gist options
  • Save telegraham/e037c208c8c7a5b133a631b326820e9f to your computer and use it in GitHub Desktop.
Save telegraham/e037c208c8c7a5b133a631b326820e9f to your computer and use it in GitHub Desktop.
# wot = [1,2,3,4,5,6,7,8].map do |number|
# number * 5
# end
# p wot
def other_map(array)
transformed_items = []
array.length.times do |i|
transformed_items << (yield array[i])
end
transformed_items
end
blat = other_map([1,2,3,4,5,6,7,8]) do |number|
number * 5
end
p blat
# def whatever
# p "about to yield"
# yield 5858585
# p "just yielded"
# end
# whatever do |something|
# p "we're in the block"
# p something
# p "we're in the block "
# end
# whatever do |something|
# p "we're in the other block hhhhhhhhhh"
# p something
# p "we're in the other block hhhhhhhhhh "
# end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment