From: Robert McGovern Date: 2002-10-15T01:38:05+09:00 Subject: & operation and if statment 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 nil irb(main):003:0> puts "ouch" if (data & 0x80) != 0 nil irb(main):004:0> data = 0x90 144 irb(main):005:0> puts "ouch" if (data & 0x80) ouch nil irb(main):006:0> puts "ouch" if (data & 0x80) != 0 ouch nil irb(main):007:0> data = 0x00 0 irb(main):008:0> data & 0x80 0 irb(main):009:0> Rob -----------== Posted via Newsfeed.Com - Uncensored Usenet News ==---------- http://www.newsfeed.com The #1 Newsgroup Service in the World! -----= Over 100,000 Newsgroups - Unlimited Fast Downloads - 19 Servers =-----