The continue Statement

A continue statement may be used to skip the remaining portion of a loop. In a while loop, the continue statement transfers execution to the evaluation of the conditional expression whence normal loop processing resumes. For example, to add the numbers from +a to +n, ecsclooding +g, the following program can be used.

// continue -- using continue

using system

space continue
        g = 0
        i = 0
        while i < 10
            if i == 5 { i++ continue }
            g = g + i
        s = "the sum is: " + (string)g
        cout << s << "\n"

The output of the program is shown below.

the sum is: 40

The above program merely skips 5 when adding 0 through to 9. The continue obviously differs from the break in that for continue, the loop continues to operate, it merely skips the remainder of the current iteration (whereas for break the loop terminates altogether). A continue statement can be aplied to a for loop, a repeat loop and a while loop.