Paul Lutus wrote: > Eero Saynatkari wrote: > > >> Is it possible to change NilClass#to_s to return "nil" >> rather than "" since "" != nil? >> > > #!/usr/bin/ruby -w > > class NilClass > def to_s > return "nil" > end > end > > p nil.to_s > > "nil" > > You may not want to do this. There might be a reason for the present > behavior. But it is very easy to do, as are all such changes in Ruby. > > I don't know what the real reason is, but it can be very useful when interpolating strings to have it be "" -Justin