Using the break Statement : Break « JSP « Java Tutorial






<HTML>
  <HEAD>
    <TITLE>Using the break Statement</TITLE>
  </HEAD>

  <BODY>
    <H1>Using the break Statement</H1>
    <%
        double array[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10};
        int sum = 0;

        for(int i = 0; i < array.length; i++) {

            sum += array[i];
            if (sum > 12) 
                break;
            out.println("Looping...<BR>");
        }
        out.println("The sum exceeded the maximum allowed value.");
    %>
  </BODY>
</HTML>








23.10.Break
23.10.1.Using the break Statement