Continue Statements

Applies To: Microsoft Dynamics AX 2012 R3, Microsoft Dynamics AX 2012 R2, Microsoft Dynamics AX 2012 Feature Pack, Microsoft Dynamics AX 2012

The continue statement causes the system to move straight to the next iteration of a for, while, or do...while loop. For do or while, the test is executed immediately. In a for statement, the increment step is executed.

If you use continue with an if statement, you can avoid deeply nested if...else statements.

Syntax

continue ;

Example

int i;
    int Iarray[100];
    ;
     
    for (i=1; i<100; i++)
    {
        if (Iarray[i] <= 0)
        continue;
     
        // Some statements.
    }

If Iarray[i] <= 0, the remaining statements in the loop are not executed, and i is incremented before the if statement is tried again.

See also

Break Statements

Do...while Loops

For Loops

if and if ... else Statements

While Loops

Announcements: New book: "Inside Microsoft Dynamics AX 2012 R3" now available. Get your copy at the MS Press Store.