This language bar is your friend. Select your favorite languages!
Edit summary for version 20 :
New Pascal implementation by user [Bart]

Version 19

Version 20

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.

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.

Extra Keywords
parallel
Extra Keywords
parallel
Imports
Math
Code
for i := 0 to Min(items1.Count-1,items2.Count-1) do 
  writeln(items1[i],', ',items2[i]);
Comments bubble
If items1 and items2 are different size, it will print only as much elements as the smallest one has.