Programming-Idioms

Implementation
JS

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.

Other implementations
import std.range;
import std.algorithm.iteration;
import std.stdio;
roundRobin(items1, items2).each!writeln;
items1.zip(items2){|pair| puts pair}
for i := 0; i < len(items1) || i < len(items2); i++ {
	if i < len(items1) {
		fmt.Println(items1[i])
	}
	if i < len(items2) {
		fmt.Println(items2[i])
	}
}
(map (lambda (x)
       (display x)
       (newline))
     (foldr append '()
            (map list items1 items2)))
interweave :: [a] -> [a] -> [a]   -- optional signature
interweave [] ys = ys
interweave xs [] = xs
interweave (x:xs) (y:ys) = x : y : interweave xs ys

main = mapM_ print $ interweave items1 items2
for pair in zip(item1, item2): print(pair)
extern crate itertools;
for pair in izip!(item1, item2) {
    println!("{:?}", pair);
}
Math
for i := 0 to Min(items1.Count-1,items2.Count-1) do 
  writeln(items1[i],', ',items2[i]);
do i=1, min(size(items1), size(items2))
  print *,items1(i), items2(i)
end do
use List::SomeUtils qw(zip);
print for zip @items1, @items2;
using System.Collections.Generic;
using System.Math;
for(int i = 0; i < Math.Max(items1.Count, items2.Count); i++)
{
  if (i < items1.Count) Console.WriteLine(items1[i]);
  if (i < items2.Count) Console.WriteLine(items2[i]);
}