title: Is it bad style to use 'return' to break a for loop in Java?
body: <p>I'm doing a project with basic Java for a CS class. The project has a for loop nested inside a while loop.</p>
  
  <p>I am <b>not allowed</b> to use <code>break</code> as a way of ending a for loop early. I found out that <code>return</code> seems to have the same effect as <code>break</code>. Is it bad style to use <code>return</code> as a way to break the loop?</p>
  
  <p>My for loop has to check through three different statements but if it finds one that is true then it is supposed to end straight away without continuing to check the rest of the statements.</p>
  
  <p>I tried to put a boolean operator in the while loop that controls the for loop but that doesn't control what goes on inside the for loop until the for loop gets to the end.</p>
  
  <p>Also does it matter if <code>return</code> doesn't return anything?</p>
  
  <p>299/01/11
  Update: Thanks everyone so much for your comments. I found it really helpful to read through all the debates.</p>
  
  <p>I spoke to my tutor and it turns out for the purposes of getting full marks, I shouldn't use <code>return</code> either. </p>
  
  <p>So I found the advice about setting a boolean in the 'for' loop really helpful, as I didn't know you could do that.</p>