19 lines
181 B
Ruby
19 lines
181 B
Ruby
|
class Impairs
|
||
|
def initialize(n)
|
||
|
@cardinal = n
|
||
|
end
|
||
|
|
||
|
def each
|
||
|
i = 1
|
||
|
@cardinal.times do
|
||
|
yield i
|
||
|
i = i + 2
|
||
|
end
|
||
|
end
|
||
|
end
|
||
|
|
||
|
Impairs.new(3).each do | i |
|
||
|
puts i.to_s
|
||
|
end
|
||
|
|