New implementation

Be concise.

Be useful.

All contributions dictatorially edited by webmasters to match personal tastes.

Please do not paste any copyright violating resource.

Please try to avoid dependencies to third-party libraries and frameworks.

Other implementations
with Ada.Text_IO;
use Ada.Text_IO;
for I in Items'Range loop
   X := Items (I);
   Put_Line (Integer'Image (I) & " " & Integer'Image (X));
end loop;
int i;
for(i=0 ; i<n ; i++){
  T x = items[i];
  printf("Item %d = %s\n", i, toString(x) );
}
(doseq [[value index] (map vector items (range))]
  (println index ": " value))
#include <iostream>
#include <vector>
for(const auto & item : items) {
  static auto idx = 0;
  std::cout << "Item " << idx++ << " = " << item << std::endl;
}
using System;
for (int i = 0; i < items.Length; i++)
{
    Console.WriteLine("{0} {1}", i, items[i]);
}
import std.stdio;
foreach(i, x; items)
{
   writefln("%s: %s", i, x);
}
import std.stdio, std.algorithm;
import std.range;
items.enumerate.each!(a => writeln("i = ", a[0], " value = ", a[1]));
items.asMap().forEach((i, value) {
  print('index=$i, value=$value');
});
for (var i = 0; i < items.length; i++) {
  print('index=$i, value=${items[i]}');
}
items
|> Enum.with_index
|> Enum.each(fn({x, i}) ->
  IO.puts("#{i} => #{x}")
end)
WithIndex =
  lists:zip(lists:seq(1, length(Items)), Items),
io:format("~p~n", [WithIndex]).
import "fmt"
for i, x := range items {
    fmt.Printf("Item %d = %v \n", i, x)
}
mapM_ print (zip [0..] items)
items.forEach(function(val,idx,ary){
  console.log("index=" + idx + ", value=" + val);
});
for (var i in items) {
   console.log("index=" + i + ", value=" + items[i]);
}
for (int i = 0; i < items.size(); i++) {
    T x = items.get(i);
    System.out.printf("Item %d = %s%n", i, x);
}
for (int i = 0; i < items.length; i++) {
    T x = items[i];
    System.out.printf("Item %d = %s%n", i, x);
}
for i, x in ipairs(items) do
	print('Index: '..i..', Value: '..x)
end
foreach ($items as $i=>$x)
{
    echo "i=$i, x=$x"; echo '<br>';
}
Classes, SysUtils
var I:Integer;
    Items: array of TObject;
[...]
  for I := 0 to high(Items) do
    if assigned(Items[I]) then
      WriteLn(Format('Item %d = %s', [I, Items[I].ToString]));
var I:Integer;
    Items: array of String;
[..]
  for I := 0 to high(Items) do
    WriteLn('Item ', I, ' = ', Items[I]);
# For an array
while ( ($idx, $val) = each @array) {
   print "array[$i] = $val\n";
}

# For a hash
while ( ($key, $val) = each %hash) {
   print "hash{$key} = $val\n";
}
for i, x in enumerate(items):
    print i, x
items.each_index{|i| puts "Item %d = %s" % [i, items[i]]}
items.each_with_index do |x, i| 
  puts "Item #{i} = #{x}"
end
for (i, x) in items.iter().enumerate() {
    println!("Item {} = {}", i, x);
}
val items = List("a", "b", "c")
items.zipWithIndex.foreach{ case (item, index) => 
  println(s"$index => $item")
}
(define (display-list items)
  (define (display-list items i)
    (if (not (null? items))
        (begin
          (display (string-append
                    (number->string i)
                    ": "
                    (number->string (first items))
                    "\n"))
          (display-list (rest items) (+ i 1)))
        'done))
  (display-list items 0))