From: Sylvain Joyeux Date: 2006-04-12T01:55:22+09:00 Subject: Re: Oddities of Iteration It does work: [~]% cat test.rb reports = ["yay!"] * 10 puts "
Reports:" puts "
    " reports.each do |x| begin puts "
  1. " + x.to_s + "
  2. " rescue puts "
  3. ...
  4. " end end puts "
" puts "
" [~]% ruby test.rb
Reports:
  1. yay!
  2. yay!
  3. yay!
  4. yay!
  5. yay!
  6. yay!
  7. yay!
  8. yay!
  9. yay!
  10. yay!
My guess is that your to_s method does puts "yay!" *and* raises an exception, instead of just returning yay! (def to_s; "yay!" end) Could you show us the definition of to_s ? Regards, Sylvain