Logo

Programming-Idioms

History of Idiom 7 > diff from v12 to v13

Edit summary for version 13 by :

Version 12

2015-08-13, 03:50:55

Version 13

2015-08-18, 21:00:18

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

Code
for (i, x) in items.iter().enumerate() {
    println!("Item {} = {}", i, x);
}