def callback(index, value) { println(`Item $index is $value.`) } array.iterate(callback)