"Dmitry V. Sabanin" <sdmitry / lrn.ru> schrieb im Newsbeitrag news:200406010130.24717.sdmitry / lrn.ru... > On Monday 31 May 2004 20:08, Robert Klemme wrote: > > "Dmitry V. Sabanin" <sdmitry / lrn.ru> schrieb im Newsbeitrag > ... > > > # 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 > Damn C background.. I always forget about this thing. Thanks, Robert It's superfluous to convert a boolean to a boolen in *all* programming languages, although special bugs can arise from these conversions only in C and other languages that don't have real booleans: #define TRUE 1 #define FALSE 0 int x; /* a boolean */ .... if ( x == TRUE ) { /* not always here if x is true! */ } This should be valid C code that does the expected thing: /* untested */ int cond_met() { return ++counter > 1; } Regards robert