title: Does the break statement break out of loops or only out of if statements?
body: <p>In the following code, does the <code>break</code> statement break out of the <code>if</code> statement only or out of the <code>for</code> loop too? </p>
  
  <p>I need it to break out of the loop too.</p>
  
  <pre><code>for (int i = 0; i &lt; 5; i++) {
      if (i == temp)
          // do something
      else {
          temp = i;
          break;
      }
  }
  </code></pre>