def oscillator x = 1 while true yield x x *= -2 end end oscillator { |x| puts x; break if x.abs > 50; }