From: Patrick Gundlach Date: 2005-12-08T09:07:35+09:00 Subject: Re: increasing counter whithin loop? [...] > There's really no difference between: > > for counter in 0...element_size > ... > end > > and > > (0...element_size).each do |counter| > ... > end OK, then it makes sense that one cannot manipulate counter. But IMO it is not intuitive (POLS ;-)) that the counter in the for-loop can't be changed. > 90% of the time you don't need counters or while loops, though. > Even here, there's nothing preventing you from doing e.g.: > > skip = false > sequence.each do |element| > if skip > skip = false > next > end > ... > # set skip to true to skip the next iteration > ... > end Yes, sure, but now it is getting ugly again. I am not looking for any way to work, but to find a readable, beautiful and ruby-like piece of code. Patrick