From: mark sparshatt Date: 2005-02-21T06:49:04+09:00 Subject: Re: destructive! operations Navindra Umanee wrote: > James Edward Gray II wrote: > >>>Bad example: >>> >>>while ( line = gets.chomp ) >>> # work with line >>>end >> >>gets() returns a String or nil. nil does not support chomp(). When >>the chomp() is inside the while loop, this isn't an issue. > > > Often think it would be nice if "" and 0 were treated like nil. Such > functions could then return "". One problem with this suggestion that comes to mind is, what if there are any blank lines in the file. then gets.chomp would return "" which would cause the while loop to exit. Probably not what you want -- Mark Sparshatt