Main Content
continue
Pass control to next iteration of for
or while
loop
Syntax
Description
continue
passes control to the next iteration
of a for
or while
loop.
It skips any remaining statements in the body of the loop for the
current iteration. The program continues execution from the next iteration.
continue
applies only to the body of the
loop where it is called. In nested loops, continue
skips
remaining statements only in the body of the loop in which it occurs.
Examples
Tips
The
continue
statement skips the rest of the instructions in afor
orwhile
loop and begins the next iteration. To exit the loop completely, use abreak
statement.continue
is not defined outside afor
orwhile
loop. To exit a function, usereturn
.
Extended Capabilities
Version History
Introduced before R2006a