Skip to content

Instantly share code, notes, and snippets.

@jheg
Last active August 29, 2015 14:02
Show Gist options
  • Save jheg/667bd3e9c0b597e43f4e to your computer and use it in GitHub Desktop.
Save jheg/667bd3e9c0b597e43f4e to your computer and use it in GitHub Desktop.
def take_block(number, &block)
block.call
end
[1, 2, 3, 4, 5].each do |number|
take_block number do
puts "Block being called in the method! #{number}"
end
end
does the same as?
[1, 2, 3, 4, 5].each do |number|
puts "Block being called in the method! #{number}"
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment