Programming-Idioms

History of Idiom 43 > diff from v57 to v58

Edit summary for version 58 :
Restored version 55

Version 57

2020-03-31, 16:28:21

Version 58

2020-03-31, 16:46:33

Idiom #43 Break outer loop

Look for a negative value v in 2D integer matrix m. Print it and stop searching.

Illustration

Idiom #43 Break outer loop

Look for a negative value v in 2D integer matrix m. Print it and stop searching.

Illustration
Code
var state_arr = new Array("Andaman & Nicobar", "Andhra Pradesh", "Arunachal Pradesh", "Assam", "Bihar", "Chandigarh", "Chhattisgarh", "Dadra & Nagar Haveli", "Daman & Diu", "Delhi", "Goa", "Gujarat", "Haryana", "Himachal Pradesh", "Jammu & Kashmir", "Jharkhand", "Karnataka", "Kerala", "Lakshadweep", "Madhya Pradesh", "Maharashtra", "Manipur", "Meghalaya", "Mizoram", "Nagaland", "Orissa", "Pondicherry", "Punjab", "Rajasthan", "Sikkim", "Tamil Nadu", "Tripura", "Uttar Pradesh", "Uttaranchal", "Wes
Code
OUTER:
for (var i in m) {
   for (var i in m[i]) {
      if (m[i][j] < 0) {
         console.log("Negative value found: "+m[i][j]);
         break OUTER;
      }
   }
}