1void f()
2{
3 int x = -1;
4 while(true)
5 {
6 if(x == 0)
7 break; // escape while() and jump to execute code after the the loop
8 else if(x == 1)
9 return; // will end the function f() immediately,
10 // no further code inside this method will be executed.
11
12 do stuff and eventually set variable x to either 0 or 1
13 ...
14 }
15
16 code that will be executed on break (but not with return).
17 ....
18}
19