Skip to content

Instantly share code, notes, and snippets.

@adamjmurray
Created July 22, 2009 05:24
Show Gist options
  • Save adamjmurray/151831 to your computer and use it in GitHub Desktop.
Save adamjmurray/151831 to your computer and use it in GitHub Desktop.
class Range
def * other
pairs = []
self.each do |i|
other.each do |j|
pairs << [i,j]
end
end
return pairs
end
end
((0...6)*(0...4)).each do |x,y|
puts "#{x},#{y}"
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment