Logo

Programming-Idioms

History of Idiom 7 > diff from v36 to v37

Edit summary for version 37 by :
New Csharp implementation by user [dhe]

Version 36

2016-02-03, 16:45:28

Version 37

2016-02-05, 08:21:55

Idiom #7 Iterate over list indexes and values

Print each index i with its value x from an array-like collection items

Idiom #7 Iterate over list indexes and values

Print each index i with its value x from an array-like collection items

Imports
using System;
Code
string[] items = { "First", "Last" };
for (int i = 0; i < items.Length; i++)
{
    Console.WriteLine("{0} {1}", i, items[i]);
}