From: Yossef Mendelssohn Date: 2007-12-12T04:28:10+09:00 Subject: Re: opposite .nil? On Dec 11, 12:56 pm, "Andrew Stone" wrote: > if not my_var.nil? > > Thanks Justin. I should have been more clear with the usage. > > def should_this_be_done? > am_I_sure? && my_object.var && !my_object.var.nil? > end > > I just think it would read better if the last test was my_object.var.exists? > > thanks, > andy > -- > Andrew Stone There's no reason to say myobject.var && !my.object.var.nil? Any object that passes the first test is not nil. The only reason to check !obj.nil? is if you want false to be an accepted value. -- -yossef