From: Michael Glaesemann Date: 2007-09-08T05:32:13+09:00 Subject: Re: nil.to_s On Sep 7, 2007, at 15:11 , Morton Goldberg wrote: > On Sep 7, 2007, at 2:44 PM, Nasir Khan wrote: > >> IMHO nil.to_s => "", nil.to_i => 0 and nil.to_a => [] are >> potential sources >> of confusion and bugs. > > > n = 4 > n.downto(0) do |k| > puts "#{k} bottle#{'s' if k != 1} of beer" > end > As I read it, OP is asking specifically about the behavior of nil.to_ (s|i|a). I may be missing something, but where does this code involve nil? k is in 4..0, but not nil. For the record, I don't have any issue with how Ruby handles nils in this case. I'm just commenting on this particular response. Michael Glaesemann grzm seespotcode net