Skip to content

Instantly share code, notes, and snippets.

@adamjmurray
Created July 22, 2009 05:24
Show Gist options
  • Select an option

  • Save adamjmurray/151831 to your computer and use it in GitHub Desktop.

Select an option

Save adamjmurray/151831 to your computer and use it in GitHub Desktop.

Revisions

  1. adamjmurray created this gist Jul 22, 2009.
    15 changes: 15 additions & 0 deletions range.*
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,15 @@
    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