On Sat, Dec 8, 2012 at 6:05 AM, zubair a. <[email protected]> wrote: > We can do so in java and similar languages like: > > for (int i=0, int j=3; i<=2 && j<=5;i++,j++){ > do some repetive task until the condition becomes false... > } > > how to keep these two conditions based on two different sets(suppose two > arrays whose indexes can be used as i and j) in condition block?? > > some working code would be greatly appreciated..thanks in advance..
In this particular case it's totally useless to use two variables in the loop condition - regardless of programming language. 0.upto 2 do |i| j = i+3 ... end for i in 0..2 j = i+3 ... end Best approach depends on your actual use case. Can you give a more concrete example of what you are trying to achieve? Cheers robert -- remember.guy do |as, often| as.you_can - without end http://blog.rubybestpractices.com/ -- You received this message because you are subscribed to the Google Groups ruby-talk-google group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at https://groups.google.com/d/forum/ruby-talk-google?hl=en
