Logo

Programming-Idioms

History of Idiom 7 > diff from v43 to v44

Edit summary for version 44 by :
New Ada implementation by user [Smaehtin]

Version 43

2016-02-16, 15:01:37

Version 44

2016-02-16, 15:24:07

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
with Ada.Text_IO;
use Ada.Text_IO;
Code
for I in Items'Range loop
   Put_Line (Integer'Image (I) & " " & Integer'Image (Items (I)));
end loop;
Comments bubble
Assuming Items is an array of integers.