Programming-Idioms

Implementation
Ruby

Be concise.

Be useful.

All contributions dictatorially edited by webmasters to match personal tastes.

Please do not paste any copyright violating resource.

Please try to avoid dependencies to third-party libraries and frameworks.

Implementation edit is for fixing errors and enhancing with metadata.

Instead of changing the code of the snippet, consider creating another Ruby implementation.

Other implementations
mainloop:
	for _, v := range a {
		for _, w := range b {
			if v == w {
				continue mainloop
			}
		}
		fmt.Println(v)
	}
mainloop: for(int v:a){
	for(int w:b){
		if(v==w)
			continue mainloop;
	}
	System.out.println(v);
}
OUTER:
for my $v (@a) {
   for my $check (@b) {
      next OUTER if $v == $check;
   }
   print "$v not in the list\n";
}
      
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");
}
'outer: for va in &a {
    for vb in &b {
        if va == vb {
            continue 'outer;
        }
    }
    println!("{}", va);
}
import std.stdio;
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);		 
	}
}
main()  {
  var a = [1, 2, 3];
  var b = [2, 3];

  outer: for (var v in a) {
    for (var w in b) {
      if (w == v) continue outer;
    }
    print(v);
  }
}
  for v in a do
    begin
      for  w in b do
        if (v = w) then
          break;
      if (v = w) then
        Continue;
      writeln(v);
    end;              
sequence_ [ print v | v <- a, [ u | u <- b, u == v] == [] ]
for v in a:
    try:
        for u in b:
            if v == u:
                raise Exception()
        print(v)
    except Exception:
        continue
$array_1 = [1,2,3,4,5];
$array_2 = [3,4];

foreach ($array_1 as $a) {
    foreach ($array_2 as $b) {
        if ($b == $a) {
            continue 2;
        }
    }
    echo $a
}
int *v = a;
while (v < a+N)
{
    int *w = b;
    while (w < b+M)
    {
        if (*v == *w)
            goto OUTER;
        
        ++w;
    }
    printf("%d\n", *v);
    
    OUTER: ++v;
}
#include <iostream>
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;
}
  outer: do i=1,size(a)
     do j=1,size(b)
        if (a(i) == b(j)) cycle outer
     end do
     print *,a(i)
  end do outer
int[] alist = {1,2,3,4,5};
int[] blist = {3,4};
int gb = 0;
foreach (int a in alist)
{
  foreach (int b in blist)
  {
    gb = b;
    if (b == a)
      break;
  }
  if (gb == a)
    continue;
  System.Console.WriteLine(a);
}