Hi –
On Wed, 4 Jan 2006, Ross B. wrote:
[[1,2,3],[2,3,4],[3,4,5]].each { it.select { it % 2 == 0 } }
(I’ve not tested that btw but you get the idea). However I guess with that
it’s also potentially confusing when using the implicit idea, since it has
the same magic variable meaning two different things in the same line. I
guess in this case I’d probably declare the argument in the select block
anyway (as ‘i’ or something).
That’s actually another good argument against “it”: you’d be trampling
the outer it with the inner it. And having to remember to declare the
inner argument to protect it from this really puts the whole thing in
the “added to the language as an afterthought” category.
David
–
David A. Black
[email protected]
“Ruby for Rails”, from Manning Publications, coming April 2006!