This language bar is your friend. Select your favorite languages!

Idiom #143 Iterate alternatively over two lists

Iterate alternatively over the elements of the list items1 and items2. For each iteration, print the element.

Explain what happens if items1 and items2 have different size.

import std.range;
import std.algorithm.iteration;
import std.stdio;
roundRobin(items1, items2).each!writeln;
for i := 0; i < len(items1) || i < len(items2); i++ {
	if i < len(items1) {
	if i < len(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){|pair| puts pair}
extern crate itertools;
for pair in izip!(item1, item2) {
    println!("{:?}", pair);
(map (lambda (x)
       (display x)
     (foldr append '()
            (map list items1 items2)))

Do you know the best way to do this in your language ?
New implementation...