Logo

Programming-Idioms

History of Idiom 7 > diff from v67 to v68

Edit summary for version 68 by miguel:
New Kotlin implementation by user [miguel]

Version 67

2019-09-26, 16:49:33

Version 68

2019-09-26, 17:49:40

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

Extra Keywords
traverse traversal
Extra Keywords
traverse traversal
Code
items.withIndex().forEach { (i, x) -> 
  print("i=$i x=$x") 
}