From: Jason Mayer Date: 2007-02-14T05:34:58+09:00 Subject: Re: quick newbie true/false/nil question ------=_Part_138714_31290069.1171398896648 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline On 2/13/07, Jeff wrote: > > > > On Feb 13, 2:24 pm, "Jason Mayer" wrote: > > I ran across this line of code today, and it doesn't make sense to me. > > > > if ((klass = CommDispatcher.check_hash(path)) == nil) > > > > How would that value ever equal nil? I thought that if klass failed to > be > > assigned to the value of CommDispatcher.check_hash(path) then the value > > would be false and if it was assigned to the value of > > CommDispatcher.check_hash(path) it would be true.. How would it be nil? > > > > Thanks! > > I'm not familiar with the CommDispatcher class, but it looks like > klass will be assigned whatever the return value of check_hash() > returns, whether that's nil or false or something else. > > Jeff Right... but isn't the assignment of the value 'nil' going to return true since the assignment succeeded? I remember screwing up a program by forgetting to put in the extra = sign once... my if blah = blah2 statement always returned true because the assignment occurred. ------=_Part_138714_31290069.1171398896648--