From: "ara.t.howard" Date: 2007-09-27T00:33:50+09:00 Subject: Re: Favorite idiom for "keep doing this until it returns nil/false" On Sep 24, 2007, at 1:30 PM, Phrogz wrote: > I want to keep running gsub! on a string until it returns nil. How do > you prefer to do this? > > true while str.gsub!( ... ) > > while str.gsub!( ... ); end > > begin > done = !str.gsub!( ... ) > end until done > > begin > made_replacement = str.gsub!( ... ) > end while made_replacement > > ...some other way? loop{ str.gsub!(re, repl) or break } a @ http://drawohara.com/ -- we can deny everything, except that we have the possibility of being better. simply reflect on that. h.h. the 14th dalai lama