Break and Continue Statements

The break and continue statements are simply keywords. Usage of break and continue is only allowed within while-statements or for-statements. break will cause execution of the current loop to terminate. continue will cause the next iteration of the current loop to begin.

> for ( i in 1:100 ) { if (i == 3) { break } } i
 i =
        3
> for ( i in 1:4 ) { if (i == 2) { continue } i }
 i =
        1
 i =
        3
 i =
        4

Although they will not be explicitly discussed - there are more examples of flow-control statement usage throughout the remainder of the primer.