Skip to content

Instantly share code, notes, and snippets.

@ianbishop
Created December 28, 2012 21:32
Show Gist options
  • Select an option

  • Save ianbishop/4402136 to your computer and use it in GitHub Desktop.

Select an option

Save ianbishop/4402136 to your computer and use it in GitHub Desktop.
gus
def some_function(a, b, &block)
v = []
(a .. b).each do |c|
v << block.call(a, c)
end
v
end
some_function(0, 10) do |a, c|
[c, a]
end
=> [[0, 0], [1, 0], [2, 0], [3, 0], [4, 0], [5, 0], [6, 0], [7, 0], [8, 0], [9, 0], [10, 0]]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment