title: Why does Java allow for labeled breaks on arbitrary statements?
body: <p>I just learned today that the following Java code is perfectly legal:</p>
  
  <pre><code>myBlock: {
      /* ... code ... */
  
      if (doneExecutingThisBlock())
          break myBlock;
  
      /* ... more code ... */
  }
  </code></pre>
  
  <p>Note that <code>myBlock</code> isn't a loop - it's just a block of code I've delimited with curly braces.</p>
  
  <p>This seems like a rather strange feature to have.  It means that you can use a named <code>break</code> to break out of an <code>if</code> statement or anonymous block, though you can't normally use a <code>break</code> statement in these contexts.</p>
  
  <p>My question is this: <strong>is there a good reason for this design decision?</strong>  That is, why make it so that you can only break out of certain enclosing statements using labeled <code>break</code>s but not regular <code>break</code>s?  And why allow for this behavior at all?  Given how (comparatively) well-designed Java is as a language I would assume there's a reason for this, but I honestly can't think of one.</p>