From: Timothy Hunter Date: 2005-06-20T20:35:35+09:00 Subject: Re: Iterate with condition G�bor SEBESTY�N wrote: > How can I do it in Ruby? I know objs.each do |anObj| ... end but it's > not (enough) good for me. I want to use additional cycle condition like > this: > > boolean b = true; > Iterator it = objs.iterator(); > while (b && it.hasMore()) { > Object anObj = it.next(); > ... > } The break statement terminates a loop. b = true foo.each { b = do_something(); break unless b}