From: Lionel Thiry Date: 2005-05-07T00:34:29+09:00 Subject: Re: What sound does no duck make? John Carter a �crit : > Imagine a flock of ducks in the sky. Listen. > Now remove the ducks. Listen. > > What is the sound of no duck quacking? > > What should nil respond_to? > > > > John Carter class Duck def initialize(name) @name = name end def quack puts "#{@name} quacks!" end end # imagine a flock of duck in the sky duck_flock = [Duck.new("redhead"), Duck.new("mallard"), Duck.new("some duck")] # listen duck_flock.each do |duck| duck.quack end # now remove the ducks duck_flock.clear # listen duck_flock.each do |duck| duck.quack end # what should nil respond to? if duck_flock.empty? puts "there are no nil's, what are you talking about?" end PS: you have read Head First Design Pattern didn't you? Good book, isn't it? But it seems you missed page 598. -- Lionel Thiry Personal website: http://users.skynet.be/lthiry/