From: "Michael W. Ryder" <_mwryder55@...> Date: 2009-12-03T10:55:11+09:00 Subject: Re: Increment outerloop value in innerloop in each do Syntax Nag Raj wrote: > Michael W. Ryder wrote: >> Nag Raj wrote: >>> { >>> 1 - its J value >>> >>> the above output using RUBY script. >>> >> I don't think you can use each on the i value. I would use a while loop >> to check for the value of i. > > Hi Michael, > > I have to get it done with each do syntax. Because I have a structure > type tag in xml file and I need to move onto next element if my > comparision goes fine. > The following outputs the same results as your C++ code: i = 0 while (i < 10) (0..5).each do |j| if (i == j) puts "#{j} its J Value" i += 1 end end puts "#{i} its I Value" i += 1 end 0 its J Value 1 its J Value 2 its J Value 3 its J Value 4 its J Value 5 its J Value 6 its I Value 7 its I Value 8 its I Value 9 its I Value If this isn't what you are looking for I don't understand what you are trying to do. > Please help me in this. Thanks in advance. > > Regards, > Nag.