title: Conditionally breaking for loops in Java
body: <p>I am trying to see if the multidimensional array is rectangular or not. I am new to programming and can't exactly figure out why the "break;" will not kick me out of the loop and it continues to run. Even with the array not being rectangular, I still get back true.</p>
  
  <pre><code>public static void main(String[] args) {
  
      int a2d[][] = {{1, 2, 3, 4, 5}, {2, 3, 4}, {1, 2, 3, 4, 5}};
  
      int test = a2d[0].length;
  
      for (int i = 0; i &lt; a2d.length; i++) {
          for (int j = 0; j &lt; a2d[i].length; j++) {
              if (a2d[i].length == test) {
                  System.out.println("True");
              } else {
                  System.out.println("False");
                  break;
              }
          }
      }
  }
  </code></pre>