From: Gavin Kistner Date: 2005-02-22T22:47:47+09:00 Subject: Re: Proposal for nil, 0, and "" in an if statement On Feb 22, 2005, at 6:41 AM, Pit Capitain wrote: > David Heinemeier Hansson schrieb: >>> Here is a proposal for evaluating "", 0, and nil in an if statement: >> I'd be pretty happy to see that happen. It would make especially Ruby >> in view logic a lot easier to deal with. > > Could anyone post examples of actual code that would be easier if 0 > had a special property in common with nil and ""? I think I never > needed this in Ruby. I don't have actual code, but imagine looping through records returned with financial data, and you want to print out a "-" if the field is missing -or- zero. The whole "this field doesn't have any meaningful information that contributes to the sum of the column" spreadsheet thing. I would support an RCR with this proposal, under just about any method name :) And I agree, boolean types need the same method as well.