Programming-Idioms

History of Idiom 42 > diff from v3 to v4

Edit summary for version 4 :

Version 3

2015-08-01, 17:54:14

Version 4

2015-08-01, 17:54:42

Idiom #42 Continue outer loop

Print each item v of list a which in not contained in list b.
For this, write an outer loop to iterate on a and an inner loop to iterate on b.

Idiom #42 Continue outer loop

Print each item v of list a which in not contained in list b.
For this, write an outer loop to iterate on a and an inner loop to iterate on b.

Code
OUTER:
for (var i in a) {
   for (var j in b) {
      continue OUTER if a[i] === b[j];
      console.log(a[i] + " not in the list");
   }
}
Code
OUTER:
for (var i in a) {
   for (var j in b) {
      continue OUTER if a[i] === b[j];
   }
   console.log(a[i] + " not in the list");
}