Logo

Programming-Idioms

History of Idiom 7 > diff from v42 to v43

Edit summary for version 43 by :
New Lua implementation by user [jparoz]

Version 42

2016-02-05, 10:54:08

Version 43

2016-02-16, 15:01:37

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 ipairs(items) do
	print('Index: '..i..', Value: '..x)
end