From: Gennady Bystritsky Date: 2009-11-16T00:51:11+09:00 Subject: Re: very newbie question On Nov 15, 2009, at 1:04 AM, 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. Not completely true. In Java, for instance, it will produce a compile error like: Test.java:40: operator ! cannot be applied to int if(!0) { ^ 1 error > > 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. >