From: Patrick Gundlach Date: 2005-12-06T02:07:33+09:00 Subject: Re: increasing counter whithin loop? Hello again, thanks for the answers. I have been very unclear what I wanted, but Malte, Guy and JEGII seemed to have read my mind. a=%w( a b b d b e ) a.each_with_index do |x, i| next if x == "b" and a[i - 1] == "b" if x=="b" and a[i+1]=="b" puts "double b" else puts x end end (slightly different code example, but closer to what I wanted). I wonder why I cannot change the variable in for i in 0...x end Or am I missing some magic? Patrick