# Zero is true, but it isn't

**URL:** <https://rubytalk.org/t/zero-is-true-but-it-isnt/26777>\
**Category:** ruby-talk\
**Created:** [19 April 2006 23:59 UTC](https://rubytalk.org/t/zero-is-true-but-it-isnt/26777 "2006-04-19T23:59:24Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Gennady\_Bystritsky1](https://avatars.discourse-cdn.com/v4/letter/g/65b543/32.png) [@Gennady\_Bystritsky1](https://rubytalk.org/u/Gennady_Bystritsky1)\
**Post date:** [19 April 2006 23:59 UTC](https://rubytalk.org/t/zero-is-true-but-it-isnt/26777/1 "2006-04-19T23:59:24Z")

</div>

If only you had any idea of how many times this was raised up and  
explained. I hope you do not find it overly rude an unwelcome if I  
suggest that you search the archive first at  
[http://www.ruby-talk.org/ruby/ruby-talk/index.shtml](http://www.ruby-talk.org/ruby/ruby-talk/index.shtml) for relevant  
discussions. It is a very good starting point in general.

Being nice ;-),  
Gennady.

> **···**
>
> > -----Original Message-----  
> > From: John Johnson [mailto:johnatl@mac.com]  
> > Sent: Wednesday, April 19, 2006 16:51  
> > To: ruby-talk ML  
> > Subject: Zero is true, but it isn't
> > 
> > I was wondering today, so I tried this:
> > 
> > puts "It's true" if 0
> > 
> > Which prints "It's true", meaning 0 is not false. (This  
> > should surprise C/C++/etc. people).
> > 
> > So that means  
> > puts "It's equal" if 0 == true
> > 
> > but 0 != true. Although it seems it should be, since 0 !=  
> > false as well. So, by extension, if an object is not nil, and  
> > it is not equal to false, then it would stand to reason that  
> > it is equal to true.
> > 
> > Any thoughts?
> > 
> > Regards,  
> > &nbsp;&nbsp;&nbsp;JJ
> > 
> > ---  
> > Help everyone. If you can't do that, then at least be nice.

---

<div class="post-metadata">

**Author:** ![John\_Johnson1](https://avatars.discourse-cdn.com/v4/letter/j/47e85d/32.png) [@John\_Johnson1](https://rubytalk.org/u/John_Johnson1)\
**Post date:** [20 April 2006 00:27 UTC](https://rubytalk.org/t/zero-is-true-but-it-isnt/26777/2 "2006-04-20T00:27:17Z")

</div>

I'll try that when the server is back up.

I thought I had an original thought. Oh well.

Regards,  
&nbsp;&nbsp;&nbsp;JJ

> **···**
>
> On 19-Apr-2006, at 19:59, Gennady Bystritsky wrote:
> 
> > If only you had any idea of how many times this was raised up and  
> > explained. I hope you do not find it overly rude an unwelcome if I  
> > suggest that you search the archive first at  
> > [http://www.ruby-talk.org/ruby/ruby-talk/index.shtml](http://www.ruby-talk.org/ruby/ruby-talk/index.shtml) for relevant  
> > discussions. It is a very good starting point in general.
> > 
> > Being nice ;-),  
> > Gennady.
> > 
> > > -----Original Message-----  
> > > From: John Johnson [mailto:johnatl@mac.com]  
> > > Sent: Wednesday, April 19, 2006 16:51  
> > > To: ruby-talk ML  
> > > Subject: Zero is true, but it isn't
> > > 
> > > I was wondering today, so I tried this:
> > > 
> > > puts "It's true" if 0
> > > 
> > > Which prints "It's true", meaning 0 is not false. (This  
> > > should surprise C/C++/etc. people).
> > > 
> > > So that means  
> > > puts "It's equal" if 0 == true
> > > 
> > > but 0 != true. Although it seems it should be, since 0 !=  
> > > false as well. So, by extension, if an object is not nil, and  
> > > it is not equal to false, then it would stand to reason that  
> > > it is equal to true.
> > > 
> > > Any thoughts?
> > > 
> > > Regards,  
> > > &nbsp;&nbsp;&nbsp;JJ
> > > 
> > > ---  
> > > Help everyone. If you can't do that, then at least be nice.
> 
> ---  
> Help everyone. If you can't do that, then at least be nice.
