From: "Brian Schröder" Date: 2005-02-22T00:24:52+09:00 Subject: Re: destructive! operations On Tue, 22 Feb 2005 00:14:41 +0900, Christian Neukirchen wrote: > Austin Ziegler writes: > > > On Mon, 21 Feb 2005 06:07:58 +0900, Navindra Umanee > > wrote: > >> Often think it would be nice if "" and 0 were treated like nil. Such > >> functions could then return "". Heck, NilClass.to_s and NilClass.to_i > >> already return "" and 0 respectively. > > > > I'm far happier that they aren't. > > > > -austin > > Sometimes, I'd like an "eating nil" that returns itself for each > method call, and is false. > > Then, stuff like that would be possible > > while line = gets.ignore_if_nil.chomp > ... > end > > Maybe just a crazy idea... :-) What would the ignore_if_nil call in your example do? Wouldn't the above be equivalent to while line = gets.chomp ... end Regards, Brian