Previous section To contents Next section

3.3.2 continue

Continue does almost the same thing as break, except instead of breaking out of the loop it only breaks out of the loop body. It then continues to execute the next iteration in the loop. For a while loop, this means it jumps up to the top again. For a for loop, it jumps to the incrementor expression. For a do-while loop it jumps down to the expression at the end. To continue our example above, continue can be used like this:
while(1)
{
    string command=Stdio.Readline()->read("> ");
    if(strlen(command) == 0) continue;
    if(command=="quit") break;
    do_command(command);
}
This way, do_command will never be called with an empty string as argument.

Previous section To contents Next section