Programming-Idioms

History of Idiom 42 > diff from v31 to v32

Edit summary for version 32 :
New Cpp implementation by user [Stanley]

Version 31

2019-09-27, 03:13:07

Version 32

2019-09-27, 10:10:40

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.

Illustration

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.

Illustration
Imports
#include <iostream>
Code
auto a = {1,2,3,4,5};
auto b = {3,5};

for (auto va: a){
    for (auto vb: b){
        if (va==vb) goto OUTER;
    }
    std::cout << va << '\n';
    OUTER: continue;
}