Programming-Idioms

History of Idiom 42 > diff from v7 to v8

Edit summary for version 8 :

Version 7

2015-08-20, 20:49:35

Version 8

2015-08-20, 23:28:46

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.

Imports
import std.stdio;
Code
auto a = [1,2,3,4,5];
auto b = [3,5];

void main()
{
mainloop:
	foreach(v;  a){
		foreach(w; b){
			if(v == w) continue mainloop;
		}
		writeln(v);		 
	}
}
Comments bubble
I wasn't aware continue to label worked in D, but apparently so.