Logo

Programming-Idioms

History of Idiom 7 > diff from v90 to v91

Edit summary for version 91 by wadsonpontes:
New Rust implementation by user [wadsonpontes]

Version 90

2020-09-02, 10:45:42

Version 91

2020-09-21, 03:39:10

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

Variables
i,x,items
Variables
i,x,items
Extra Keywords
traverse traversal
Extra Keywords
traverse traversal
Code
for (std::size_t ix = 0; ix < items.size(); ++ix) {
	for (std::size_t jx = 0; jx < items[ix].size(); ++jx)
  		std::cout << "Item " << jx << " = " << items[ix][jx] << std::endl;
	}
}