From: Kristof Bastiaensen Date: 2004-05-20T01:43:59+09:00 Subject: Re: Zero is true ... whoda thunk? Hi, On Wed, 19 May 2004 11:40:36 -0400, Mary M. Inuet wrote: > Arguments about the elegance or uniformity of zero's truth are pretty weak > in my opinion, due to the fact that Ruby does not exist in a vacuum. LOTS > of external libraries, extensions, interfaces, etc, implicitly and > explicitly require zero to be false. Perhaps that's because most libraries, extensions end interfaces are written in C, where zero is (used to be) the one and only false value? Please note that even in assembler zero is not a false value. In fact in assembler there isn't even a false value. If you perform a conditional jump, that jump will be based on a condition, which can be "equal to 0", "less than zero", "greater than O", etc. The thing is that boolean values (false and true) are a totally different thing than other objects. They show the correctness of an expression. If you would say zero means false, than you would say (5 - 5) is false. From a mathmaticians point of view (which I am not ...), (5 - 5) is a completely valid expression. It makes sense that any expression which gives just an object is true (valid). Nil may be an exception, but nil is normally used to mean "not a valid object", so it's value as false is quite logical. Regards, Kristof