All pastes #151804 Raw Edit

Someone

public text v1 · immutable
#151804 ·published 2006-08-28 12:56 UTC
rendered paste body
# code:

class Lego

        @count = 0
        attr_reader :picks

        def initialize( *picks )
                if picks.uniq.length != 1
                        raise ArgumentError, "numbers not Identical"
                end
                @picks = picks
        end
        def self.new_random
                new( rand( 25 ), rand( 25 ) )
        rescue ArgumentError
                @count += 1
                retry
        end
end


Lego.new_random
p Lego.@count


# output:
# randexp.rb:23: syntax error, unexpected tIVAR