Shiny Language Reference

Language Reference > Basic Language


break

break;

 

Aborts the innermost execution loop

The BREAK statement is only valid when used inside a FOR or WHILE loop. It immediately causes execution of the code segment inside the loop to abort, and execution resumes at the first instruction after the end of the loop.

If loop conditions are nested, the BREAK statement only exits the innermost loop. To exit all nested loops refer to BREAKALL.

 

Parameters

None

 

Return Value

No return value, this is a statement.

 

Example Code

while(bContinueProcessing == TRUE)
{
    // Immediately abort the while loop
    break;
}

// Code execution resumes here

 

for(int Counter = 0; Counter < 10; Counter++)
{
    
while(bContinueProcessing == TRUE)
    {
        // Immediately abort the while loop
        break;
    }

    // Code execution resumes here
}