Logo

Programming-Idioms

History of Idiom 143 > diff from v5 to v6

Edit summary for version 6 by steenslag:
[Ruby] did not fit on one line

Version 5

2016-08-25, 22:26:30

Version 6

2016-08-25, 22:29:48

Idiom #143 Iterate alternatively over two lists

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

Idiom #143 Iterate alternatively over two lists

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

Extra Keywords
parallel
Extra Keywords
parallel
Code
[items1, items2].transpose.each{|ar| ar.each{|item| p item }}
Code
[items1, items2].transpose.each{|ar| 
  ar.each{|item| p item }
}