From: Love U Ruby Date: 2013-03-11T19:05:11+09:00 Subject: Re: Confusion with block local variable declaration with block variable declaration within the pipe Joel Pearson wrote in post #1101045: > You're looking for "Inject" > http://ruby-doc.org/core-2.0/Enumerable.html#method-i-inject No, please look at the symbol `;`, which is used to declare block local variables with the block parameters inside the `|`. >> [1,2,3].each {} => [1, 2, 3] >> [1,2,3].each {|x;y| print y} => [1, 2, 3] >> [1,2,3].each {|x;y| y=x; print y} 123=> [1, 2, 3] See above. Here `x` is block parameter and `y` is local variable to the block. The only problem if you try to get that `y` to initialize in the same place inside the `|`. - Why so? -- Posted via http://www.ruby-forum.com/.