About Question enthuware.ocajp.i.v7.2.1057 :
Posted: Sat Sep 15, 2012 12:05 pm
Hi folks,
I believe that the explanation on this question is misleading. It states: "Because break JILL; would be valid only if JILL is labelling a loop or a block. In this case, there is no loop/block for break JILL; to break."
Well, it is legal to put a label on a "simple" statement, however meaningless, so this should not be a factor in consideration. One cannot break a label unless he is inside that label's statement, and this seems to be the problem in this question.
In fact, { mylabel: break mylabel; } works on my machine. And so does { mylabel: if (a > b) break mylabel; }
I believe that the explanation on this question is misleading. It states: "Because break JILL; would be valid only if JILL is labelling a loop or a block. In this case, there is no loop/block for break JILL; to break."
Well, it is legal to put a label on a "simple" statement, however meaningless, so this should not be a factor in consideration. One cannot break a label unless he is inside that label's statement, and this seems to be the problem in this question.
In fact, { mylabel: break mylabel; } works on my machine. And so does { mylabel: if (a > b) break mylabel; }