Logo

Programming-Idioms

This language bar is your friend. Select your favorite languages!
  • Rust
items.iter().enumerate().for_each(|(i, x)| {
    println!("Item {} = {}", i, x);
})
for (i, x) in items.iter().enumerate() {
    println!("Item {} = {}", i, x);
}
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;

Assuming Items is an array of integers.

New implementation...