break case, continue case, continue with next case, break loop, continue loop, break, continue
break...;
continue... ;
The influence the control flow inside loops (including do, while, until, for, for all .. ,
table process ... as follows:
break case skips the remaining code till the end of the switch/check block. Even the else statement will be skipped.
continue case skips the remaining code inside that case block, then continues checking the next case and else statements.
break loop skips the remaining code till loop end, stops the loop and continues with next statements after the loop.
continue loop skips the remaining code till loop end and continues with the next loop round, provided the loop condition is met.
continue with next case skips the remaining code inside that case block and executes the next case block, regardless if the condition inside the case is met or not.
break applies to loops or case, whatever is closer.
continue applies to loops or cases, whatever is closer.
Indirect parameter passing is disabled
0
echo("Try 'break' and 'continue with next case':'");
for (a[] = 1, a[] <= 4, a[]++)
{
print ( " ",a[], ": " );
switch( a [] )
{
case (1)
{
print("= 1; ");
continue with next case;
}
case (2)
{
print("= 2; ");
break;
}
case (4,1) print("= 1 or 4; ");
else: print("else; ");
else: print("2nd else; ");
}
echo;
}
echo("Break and continue loops");
for (a[] = 1, a[] <= 4, a[]++)
{
echo(" Loop begin ", a[] );
if (a[] = 2) continue;
if (a[] = 3) break;
echo(" Loop end ", a[] );
}
Try 'break' and 'continue with next case':'
1: = 1; = 2;
2: = 2;
3: else; 2nd else;
4: = 1 or 4; 2nd else;
Break and continue loops
Loop begin 1
Loop end 1
Loop begin 2
Loop begin 3