Jumps the flow of control to the end of the immediate loop and executes the first instruction following the loop. This is different from a return, which leaves all loops and the function scope. Break is only meaningful inside of a loop.
function Foo()
{
while (true)
{
while (z < 5)
{
...
if (x == false)
{
break; // jumps to line following while (z < 5) {}
}
if (y == true)
{
return 5; // returns from Foo() immediately
}
}
if (x == false)
{
break; // jumps to line following while (true) {}
}
}
...
return -1; // returns from Foo() immediately
}
|
Copyright © 2013 CA.
All rights reserved.
|
|