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