Nested "Repeat" Loops?


#1

What order do nested repeat loops get executed? Inner to outer? Does anyone have a real world example?


REPEAT A;
  REPEAT B;
    REPEAT C;
    UNTIL C3;
  UNTIL B2;
UNTIL A1;


#2

How about a couple of pictures. First, let me re-write your OptoScript a little w/some comments:


repeat
  A;    // do something here, then loop on these other loops, then do it all again if (ending when) A1 is true
  repeat 
    B;    // do this, do the next loop, then do it if B2 is true, forever, until B2 is true
    repeat 
      C;
      until C3; // maybe bail out of this inner loop (which we might come back to multiple times depending on outer loops)
  until B2; // bail out of this loop when B2 is true
until A1;  // bail out of this loop when A1 is true

Here’s the equivalent in blocks.

Hope that helps!