From: Peter Hickman Date: 2013-03-11T19:28:45+09:00 Subject: Re: Confusion with block local variable declaration with block variable declaration within the pipe `|` --047d7b621fba1ee17004d7a3a372 Content-Type: text/plain; charset=ISO-8859-1 Actually the error message is the clue here. [1,2,3].each {|num;temp =0| temp = num;print temp} #SyntaxError: (irb):5: syntax error, unexpected '=', expecting '|' #[1,2,3].each {|num;temp =0| temp = num;print} Again why you assigning to temp and when you immediately overwrite it? This works [1,2,3].each {|num;temp| temp = num;print temp} --047d7b621fba1ee17004d7a3a372 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable
Actually the error message is the clue here.

[1,2,3].e= ach {|num;temp =3D0| temp =3D num;print temp}

#SyntaxError: (irb):5: syntax er= ror, unexpected '=3D', expecting '|'
#[1,2,3].each {= |num;temp =3D0| temp =3D num;print}
Again why you assigning to temp a= nd when you=A0immediately=A0overwrite it? This works

[1,2,3].each {|num;temp| temp =3D num;print temp}
--047d7b621fba1ee17004d7a3a372--