Created
September 17, 2018 22:26
-
-
Save telegraham/e037c208c8c7a5b133a631b326820e9f 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
# 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