Logo

Programming-Idioms

History of Idiom 7 > diff from v16 to v17

Edit summary for version 17 by :

Version 16

2015-08-20, 15:32:13

Version 17

2015-08-21, 07:05:12

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
SysUtils
Code
var Iter:Integer;
    Items: array of String;
[..]
  for Iter := 0 to high(Items) do
    WriteLn(Format('Item %d = %s', [Iter, Items[Iter]]));