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

Idiom #141 Iterate in sequence over two lists

Iterate in sequence over the elements of the list items1 then items2. For each iteration print the element.

import std.range;
import std.algorithm.iteration;
import std.stdio;
chain(items1, items2).each!writeln;
1
for _, v := range items1 {
	fmt.Println(v)
}
for _, v := range items2 {
	fmt.Println(v)
}
mapM_ print $ items1 ++ items2
[items1, items2].each{|ar| ar.each{|item| p item }}
for i in item1.chain(item2) {
    print!("{} ", i);
}
(map (lambda (x)
       (display x)
       (newline))
     (append items1 items2))

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

Idiom created by

BBaz

Related idioms