tags:

views:

94

answers:

1

Let's say I have

some_value = 23

I use the integer and the .times to loop.

Inside the iteration, is there an easy way, without keeping a counter, to see what iteration the loop is currently in?

+4  A: 

Yes, just have your block accept an argument:

some_value.times{|i| ... }
Ken
Thanks for pointing me to the obvious. Silly me, shows what late night RTFMing and caffeine does to a brain *pre-empts further stackoverflow posts*
Forkrul Assail