Page 1 of 1

About Question enthuware.ocajp.i.v7.2.1057 :

Posted: Sat Sep 15, 2012 12:05 pm
by ETS User
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; }

Re: About Question enthuware.ocajp.i.v7.2.1057 :

Posted: Sun Sep 16, 2012 5:55 am
by admin
You are right but I think that is what the explanation tries to convey as well. It says "because break JILL; would be valid if...", put differently, it says break JILL is invalid in the present situation because JILL does not label a block that can be broken out of.

The explanation has now been updated to make it more clear.

thank you for your feedback!!