next: Start next iteration of a loop

Package: language

Usage

next

Description

The next statement begins the next iteration of the loop construct in which it is enclosed, without executing any of the statements remaining before the end of the loop.

Examples

1. Sum the pixels in a two dimensional array. Skip any negative valued pixels.

for (i=1;  i <= NCOLS;  i+=1) {
    for (j=1;  j <= NLINES;  j+=1) {
        if (pixel[i,j] < 0)
            next
        total += pixel[i,j]
    }
}

See also

break, while, for