Java Programming/Keywords/continue

From Wikibooks, open books for an open world
< Java Programming‎ | Keywords
Jump to: navigation, search

continue is a Java keyword. It skips the remainder of the loop and continues with the next iteration.

For example:


Computer code
for ( int i=0; i < maxLoopIter; i++ ) {
   if ( i == 5 ) {
      continue;  // -- 5 iteration is skipped --
   }
   System.println("Iteration = " +i);
}


See also: