这是在Java中使用标签的好处之一:
block:{ // some pre if(condition) break block; // rest of pre that won't be executed if condition is true}嵌套循环的另一种用法:
outterLoop: for(int i = 0; i < 10; i++){ while(condition) { // some pre if(someConditon) break outterLoop; // break the for-loop if(anotherConditon) break; // break the while-loop // another pre } // more pre}要么:
outterLoop: for(int i = 0; i < 10; i++){ while(condition) { // some pre if(someConditon) continue outterLoop; // go to the next iteration of the for-loop if(anotherConditon) continue; // go to the next iteration of the while-loop // another pre } // more pre}


