MATLAB Function Reference Previous page   Next Page
continue

Pass control to next iteration of for or while loop

Syntax

Description

continue passes control to the next iteration of the for or while loop in which it appears, skipping any remaining statements in the body of the loop.

In nested loops, continue passes control to the next iteration of the for or while loop enclosing it.

Examples

The example below shows a continue loop that counts the lines of code in the file magic.m, skipping all blank lines and comments. A continue statement is used to advance to the next line in magic.m without incrementing the count whenever a blank line or comment line is encountered.

See Also

for, while, end, break, return


Previous page  conj contour Next page

© 1994-2005 The MathWorks, Inc.