From: 7stud -- Date: 2009-11-15T22:44:05+09:00 Subject: Re: very newbie question duxieweb wrote: > 2009/11/15 Stefano Crocco : > >> >> Because 0 is a true value in ruby, so !queue is false and the body of the if >> expression is not executed. In ruby, the only false values are false and nil. >> > > Oh, that sounds so different from other languages that 0 is a true > value. > > python: >>>> x=0 >>>> if (not x): > ... print "x is false" > ... > x is false > > perl: > # perl -le '$x=0; print "x is false" if not $x' > x is false > > > Thank you. You might want to take a look at these examples: python: x = 0 if x: print "x is true" else: print "x is false" --output:-- x is false perl: $ perl -lwe 'my $x=0; if ($x) {print "x is true";} else {print "x is false"}' x is false $ -- Posted via http://www.ruby-forum.com/.