From: Robert Klemme Date: 2004-05-31T21:08:37+09:00 Subject: Re: elegant way to say "try this thing, one at a time, until condition is met" "Dmitry V. Sabanin" schrieb im Newsbeitrag news:200405311648.43813.sdmitry@lrn.ru... > On Monday 31 May 2004 16:31, David Garamond wrote: > > Example: I need to unmount /usr and /usr2, but currently I can't because > > there are some opened files from those partitions. I am going to try > > shutting down daemons or killing some processes (or other things), one > > at a time, until I can unmount it. > Sorry if that's not what you want, but i had this idea when I read your post: > > # emulating condition > $counter = 0 > def cond_met > $counter += 1 > $counter > 1 ? true : false > end Just a sidenote: you don't have to convert the result of a boolean expression to boolean by means of the ternary operator. This will do exactly the same: def cond_met ( $counter += 1 ) > 1 end Regards robert