Logo

Programming-Idioms

History of Idiom 163 > diff from v11 to v12

Edit summary for version 12 by Debaran:
New Scala implementation by user [Debaran]

Version 11

2019-01-02, 10:57:54

Version 12

2019-02-02, 04:51:38

Idiom #163 Print list elements by group of 2

Print all the list elements, two by two, assuming list length is even.

Idiom #163 Print list elements by group of 2

Print all the list elements, two by two, assuming list length is even.

Code
list.grouped(2).foreach(p => println(s"(${p(0)}, ${p(1)})"))