On Tue, 2013-11-05 at 16:23 -0800, Justin Collins wrote:
> This is a block, just like any other block.

Yes indeed -- in Ruby each loop is in first order a block, that is what
I forgot. For a block this behaviour is well documented. I have a loop
with two iterations, in the first iteration I make some expensive
calculations, which I would like to reuse in the second iteration. So I
have to define that variables before the loop, and of course I have to
write j = 0; 2.times{|i| -- not 2.times{|i; j|.

I should really try hard to remember that.

Thanks,

Stefan Salewski