break, continue
break breaks switch and check blocks or loops, whichever is closer.
continue continues switch and check blocks or loops, whatever is closer.
See also:
Indirect parameter passing is disabled
0
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[] );
}
echo("Break and continue cases");
for (a[] = 1, a[] <= 4, a[]++)
{
echo(" Loop begin ", a[] );
switch(a[])
{
case (2) break; // Breaks case only
case (3)
{
repeat(5, b[])
{
echo("Inner loop: ", b[]);
if (b[]==2) break; // Break the inner loop
}
echo("Inner loop done");
}
}
}
Break and continue loops
Loop begin 1
Loop end 1
Loop begin 2
Loop begin 3
Break and continue cases
Loop begin 1
Loop begin 2
Loop begin 3
Inner loop: # Invalid Value #
Inner loop: 1
Inner loop: 2
Inner loop done
Loop begin 4
break loop
continue loop
break case
continue case
switch
check