On Apr 19, 2009, at 1:07 PM, Yoann Guillot wrote: > On Mon, Apr 20, 2009 at 01:41:05AM +0900, Leo wrote: >>> It seems that the 'retry' keyword is not supported anymore in >>> ruby1.9 to >>> restart a running iteration from the beginning. >> >> Are you sure you don't want to use 'redo'? >> >> $ ruby -ve '[1, 2].each { puts "bla" ; redo }' >> ruby 1.9.1p0 (2009-01-30 revision 21907) [i386-cygwin] >> bla >> bla >> ... >> > > redo reruns the current iteration, retry restarted the whole iteration > > [1, 2].each { |i| puts i ; redo if i == 2 } >> 1 2 2 2 2 2 2 > [1, 2].each { |i| puts i ; retry if i == 2 } >> 1 2 1 2 1 2 1 $ ruby_dev -ve '[1, 2].cycle { |i| puts i }' ruby 1.9.2dev (2009-04-13) [i386-darwin9.6.0] 1 2 1 2 1 2 1 2 -e:1:in `write': Interrupt from -e:1:in `puts' from -e:1:in `puts' from -e:1:in `block in <main>' from -e:1:in `cycle' from -e:1:in `<main>' James Edward Gray II