Skip to main content
added 24 characters in body
Source Link
Georg Plaz
  • 6k
  • 5
  • 44
  • 66

Like @1800 INFORMATION suggestion, use the condition that breaks the inner loop as a condition on the outer loop:

boolean hasAccess = false; for (int i = 0; i < x && hasAccess == false; i++){   for (int j = 0; j < y; j++){   if (condition == true){   hasAccess = true;   break;   }   } } 

Like @1800 INFORMATION suggestion, use the condition that breaks the inner loop as a condition on the outer loop:

boolean hasAccess = false; for (int i = 0; i < x && hasAccess == false; i++){ for (int j = 0; j < y; j++){ if (condition == true){ hasAccess = true; break; } } } 

Like @1800 INFORMATION suggestion, use the condition that breaks the inner loop as a condition on the outer loop:

boolean hasAccess = false; for (int i = 0; i < x && hasAccess == false; i++){   for (int j = 0; j < y; j++){   if (condition == true){   hasAccess = true;   break;   }   } } 
Source Link
mtyson
  • 8.7k
  • 18
  • 78
  • 115

Like @1800 INFORMATION suggestion, use the condition that breaks the inner loop as a condition on the outer loop:

boolean hasAccess = false; for (int i = 0; i < x && hasAccess == false; i++){ for (int j = 0; j < y; j++){ if (condition == true){ hasAccess = true; break; } } }