MOO-cows Mailing List Archive

[Prev][Next][Index][Thread]

RE: Unusual comparison behaviors





----------
From:  slayer@kaiwan.com[SMTP:slayer@kaiwan.com]
Sent:  Tuesday, February 20, 1996 11:34 PM
To:  moo-cows@parc.xerox.com
Subject:  Re: Unusual comparison behaviors

>These formulae produce these results:
>
> 1 && #1   -->  #1
> 0 && #1   -->  0
> 
> #1 && 1   -->  #1
> #1 && 0   -->  #1   (shouldn't this be 0?)

Nope, #1 is false so it never gets to 0.

Interesting.  Until you said this I never actually noticed that {}, "", and 0 return, respectively, values of {}, "", and 0, when they evaluate to false.  I always tend to assume that 0 is false and everything else is true,  1 && ""  would have returned 0, not ""...

Ah well, live and learn. :)  Still, given this, I would have thought it better to have any OBJ return as true instead of false.





Home | Subject Index | Thread Index