From: Robert Klemme Date: 2005-12-05T23:27:33+09:00 Subject: Re: increasing counter whithin loop? Patrick Gundlach wrote: > Hi, > > a very basic question... > > I'd like to output the sequence "a b d e", by testing if the current > element is == "b" then skip the next element and continue the loop. > The obvious solution doesn't look rubyish to me, how could I use the > first or second attempt to get the desired solution? > > Patrick > -------------------------------------------------- > a=%w( a b c d e ) >> a=%w( a b c d e ) => ["a", "b", "c", "d", "e"] >> a.each do |elt| ?> next if elt=="b" >> puts elt >> end a c d e => ["a", "b", "c", "d", "e"] >> Kind regards robert