From: Mohammad Khan Date: 2004-10-30T06:24:49+09:00 Subject: Re: Another scrach on head > > > > In other words > > > > a = Whatever.new > > > > puts "a is nil" if a.nil? > > puts "a is neither nil, nor false" if a > > puts "a is true" if a == true > > puts "a is false" if a == false > > puts "a is nil again!" if a == nil > > You could also say > > puts "a is true" if a David, I don't agree at this point, I would like to say puts "a is neither nil, nor false, nor FALSE" if a puts "a is true" if a == true I consider nil, false and true as three different entity. I don't need to show you irb screen output to illustrate it. Thanks, Mohammad > puts "a is false" if a.nil? > > in the Boolean sense of true/false. Ruby provides the constants TRUE > and FALSE, for the respective objects; this might be a good way to > write your example (and my additions): > > puts "a is nil" if a.nil? > puts "a is neither nil, > nor false, nor FALSE" if a > puts "a is TRUE" if a == TRUE > puts "a is true" if a > puts "a is FALSE" if a == FALSE > puts "a is false" if not a > puts "a is nil again!" if a == nil > puts "a is false" if a.nil? > > Here, I'm using 'true/false' to mean Boolean true/false, and > TRUE/FALSE to mean the objects. > > > David -- Mohammad Khan Legal Computer Solutions, Inc.