在Java中,我們可以做的事情,如:德爾福有沒有塊標籤?
String output = "";
stop: {
// count 10 lines
for (int row = 1; row <= 10; row++){
// count 5 columns
for (int column = 1; column <= 5; column++ {
if (row == 5)
break stop;
output += "* ";
}
output += "\n";
}
output += "\nTerminated Ok.";
}
結果是10行的打印,但它結束於5:
* * * * *
* * * * *
* * * * *
* * * * *
* * * * *
是否有德爾福相同呢?
[聲明塊級別變量在Delphi分支]的可能重複(http://stackoverflow.com/questions/6519191/declaring-block-level-variables-for-branches-in-delphi) – NINCOMPOOP
的問題中的代碼不需要標記中斷。也許你應該包括一個更現實的例子,它需要一個標籤打破? –
好的。沒問題。 – PSyLoCKe