Programming-Idioms

History of Idiom 163 > diff from v19 to v20

Edit summary for version 20 :
New Csharp implementation by user [bigwavedave]

Version 19

Version 20

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.

Imports
using System.Collections.Generic;
Code
for(int i = 0; i < list.Count; i += 2) {
  Console.WriteLine(string.Format("{0}, {1}", list[i], list[i + 1]));
}