cours0708/P5B/ruby/each_even.rb

11 lines
95 B
Ruby

def each_even(n)
for i in 0...n
yield(2*i)
end
end
each_even(10) do | i |
puts i
end