From: Chad Perrin Date: 2007-10-15T14:29:36+09:00 Subject: Re: nil.to_i returning zero On Mon, Oct 15, 2007 at 04:40:35AM +0900, Gerardo Santana G?mez Garrido wrote: > > What does nil.to_i return? Zero. And I wonder why. How can nil be > interpreted as a number. It's beyond me. There's been a few attempts to answer the question already. I'm curious, though: What would you expect it to return, and why would you think that should be the expected behavior? Nothing immediately occurs to me as a better result of evaluating nil.to_i than 0, within the context of the Ruby language, but if you have an alternative view I'm open to learning from it. -- CCD CopyWrite Chad Perrin [ http://ccd.apotheon.org ] Patrick J. LoPresti: "Emacs has been replaced by a shell script which 1) Generates a syslog message at level LOG_EMERG; 2) reduces the user's disk quota by 100K; and 3) RUNS ED!!!!!!"