From: Brian Candler Date: 2007-03-08T21:32:05+09:00 Subject: Re: elseif v. elsif ?? On Thu, Mar 08, 2007 at 08:49:00PM +0900, Jenda Krynicky wrote: > Let's see ... what does this code do? > > for my $obj (@list) { > $obj->foo() > } > > Well, that's clear, it calls the foo() method on all objects in the > @list. OTOH, what does this one do? > > list.each { |obj| obj.foo() } > > Well, maybe it does the exact some thing ... and maybe it also changes > the obj variable from whatever it was before this line to the last > object in the list. FWIW, I understand this is/has changed in ruby 1.9, so that block parameters are always local to the block.