From: dblack@... Date: 2002-10-15T01:43:00+09:00 Subject: Re: & operation and if statment Hi -- On Tue, 15 Oct 2002, Robert McGovern wrote: > I'm puzzled by the behaviour in the following run. I would expect line 2 > to not print out "ouch" because the result of the if statement is 0 > (verified online 8) > > $ ruby -v > ruby 1.7.3 (2002-09-20) [i386-cygwin] > > $ irb > irb(main):001:0> data = 0x00 > 0 > irb(main):002:0> puts "ouch" if (data & 0x80) > ouch Don't forget that 0 is true. David -- David Alan Black home: dblack@candle.superlink.net work: blackdav@shu.edu Web: http://pirate.shu.edu/~blackdav