Michael Geary wrote:
> Suppose you have zero quarts of milk in your refrigerator. I am visiting and
> I ask:
> 
> Got milk?

if (milk_qty > 0)
   puts "yes"
else
   puts no"
end

Wouldn't that be the ruby translation of what you're asking?

Or maybe you don't care if milk_qty is negative:

if (milk_qty == 0)
   puts "no"
else
   puts "yes"
end

What you're asking is "as a general rule, when I convert a number into a 
boolean, what value should it have".  And why is it natural that zero be 
naturally 'false' while every other number be naturally 'true'.

This is the sort of thing you can't give a general rule for that will 
always work.  Zero as false makes sense for converting from the number 
of bottles of milk to answer the question "do you have any milk?"  On 
the other hand, it doesn't make as much sense for translating the score 
of a sports game to "has the game started".  In this case, any number 
means that the game as started.  What about "Are we doing better than 
last time?"  In this case, if the number is positive, then the answer is 
'true', if the number is negative, then the answer is 'false'.  Does 
that mean that the boolean representation of '-1' should be false, as 
well as every other negative number?

Converting numbers to boolean values is a problem-specific issue, and 
shouldn't have a general case.  What's so difficult about using tests 
like (foo == 0) and (foo > 0) anyhow?

Ben