From: Sebastian Biallas Date: 2005-06-20T20:40:35+09:00 Subject: Re: Iterate with condition G�bor SEBESTY�N wrote: > Hi, > > [..] > boolean b = true; > Iterator it = objs.iterator(); > while (b && it.hasMore()) { > Object anObj = it.next(); > ... > } > > What is the equivalent to this in Ruby? You can abuse Enumerable#find for this: objs.find do |obj| # do something with obj !b # return true to stop end I don't know wether is very rubyish ;) > Thanks, > > G�bor Sebastian