From: Dan Fitzpatrick Date: 2005-02-22T21:56:16+09:00 Subject: Re: Proposal for nil, 0, and "" in an if statement --------------050603040304090209060501 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Bertram Scharpf wrote: >Hi, > >Am Dienstag, 22. Feb 2005, 20:49:51 +0900 schrieb Dan Fitzpatrick: > > >>The following was derived from a portion of the destrutive! operations >>thread. >> >>Here is a proposal for evaluating "", 0, and nil in an if statement: >> >>Add empty? to NilClass and Fixnum >> >>nil.empty? => true >>0.empty? => true >> >>These already exist: >>"".empty? => true >>[].empty? => true >>{}.empty? => true >> >> > >Maybe even "true.empty? #=> true", "false.empty? #=> false"? > >A good chance to end the discussions started over and over >about strings and numbers in `if' clauses, I think. > >Bertram > > > > I would reverse the true and false: true.empty? => false false.empty? => true These are not quite as intuitive as NilClass and Fixnum but I agree they would be nice to have as well. Dan --------------050603040304090209060501--