Continue function

Syntax

Continue

Description

Use the Continue statement to continue execution in a loop. How the statement performs depends on the type of loop:

  • In For loops, this statement continues to do the next step of the iteration

  • In While loops, this statement continues to the top of the loop and the test of the condition

  • In Repeat-Until loops, this statement continues to the Until check at the bottom of the loop.

Parameters

None.

Example

The following are tests of the continue statement in various types of loops:

SetTracePC(%TracePC_List);
/* tests of continue statement */
&N = 0;
For &I = 1 To 10;
   If &I > 5 Then
      Continue;
   End-If;
   &J = &I + 1;
   &K = 0;
   /* now a while loop in here */
   While &J <= 10;
      &J = &J + 1;
      If &J = 7 Then
         Continue;
      End-If;
      For &A = 0 To 5;
         &K = &K + 2;
      End-For; /* no continue statement */
      &Barf = 2;
      Repeat
         &Barf = &Barf;
         If &Barf = 1 Then
            Continue;
         End-If;
      Until &Barf = &Barf;
      &K = &K + 1;
   End-While;
   MessageBox(0, "", 0, 0, "K=" | &K);
   If &I < 2 Then
      Continue;
   End-If;
   &N = &N + 1;
End-For;
MessageBox(0, "", 0, 0, "N=" | &N);

Related Topics