From: Hussachai Puripunpinyo Date: 2006-09-20T20:22:52+09:00 Subject: Re: Something strange in ruby or I'm a newbie? Ryan Davis wrote: > On Sep 20, 2006, at 3:37 AM, Hussachai Puripunpinyo wrote: > >> puts nil==nil #Yeah that's true >> puts !nil #true >> puts !nil==true #true >> puts nil==false #FALSE !!! >> >> What happen in the last statement? [or I miss something] > > nil isn't false. Both nil and false are objects in ruby. Compare: > > % irb > >> [nil, false].map { |o| o.object_id } > => [4, 0] Thank you Davis. I assume you told me that "==" mean "compare with object_id that's right? Uhmm.. it's OK in other lang use this idea such as Java negative of every object(I'm not sure) in ruby except nil and false is false; negative of nil and false is true How about 1 and 1.0 both are the same object? the rule that I just assume above was broken? and why every object except nil and false return false what's the reason? there have already exist in the FAQ? -- Posted via http://www.ruby-forum.com/.