zero in Ruby is true, not false, in a boolean context.

What does false.to_i return? An exception. There is not a numeric
interpretation for false.

What about nil. nil is nothing. The only other object that evaluates
to false in a boolean context.

What does nil.to_i return? Zero. And I wonder why. How can nil be
interpreted as a number. It's beyond me.

Anyone care to explain it to me?

So far I've found the following links about the issue:

http://www.oreillynet.com/ruby/blog/2005/12/is_this_a_good_thing_or_not.html
http://journal.dedasys.com/articles/2007/05/08/rails-bitten-by-rubys-nil-to_f
http://groups.google.com/group/ruby-talk-google/browse_thread/thread/a475bb8a541f700e/b9f0cac6945a4210?lnk=gst&q=nil.to_i#b9f0cac6945a4210

-- 
Gerardo Santana