From: Trans Date: 2007-01-14T02:37:08+09:00 Subject: Re: return_on Devin Mullins wrote: > Trans wrote: > > funny thing i just came across a similar case for break. how would you > > DRY this up and get rid of 'result'? > > > > result = nil > > files.each do > > result = require file > > break if result > > end > > if result > > ... > > Well, this is much easier: > > if files.any? {|file| require file } > ... Cool, I forget that #any? will break after the first true encounter. I used #find as pit suggested (which can return any value actually). But, that wasn't really my point. Such a solution breaks the analogy to the original return case --whihc can't be DRYed-up that way. T.