Eric Mahurin wrote: > That sure looks ugly. I don't see any advantage of this over: > > my_array.each do |item| > puts "item" > end > if my_array.empty? > puts "(no items found)" > end *shrug* I personally prefer what I posted over this. (I tend to use { and } for blocks instead of begin/end in my own code because IMHO it visually groups it better, but I used begin/end here since that seems to be the emerging multi-line choice of the community.) > What you have below doesn't look to readable and it is using > undocumented behavior (the docs don't say what each returns > only that it is an enumeration). In ruby 1.6 docs, it says > that each_with_index returns nil and now it returns the object. As I noted in another response, a lack of documentation calls for fixing the documentation (as is needed in more than a few places in Ruby), not for not using the method fully. And that the behavior of this--and other like-minded--methods has changed between 1.6 and 1.8 is not unique among aspects of Ruby. Just 'cause it changed, don't mean it broke. :)