kotlin foreachindexed
simpleArray.forEachIndexed{index, element -> println("index = $index, element = $element")}
// print on console
// ->
/*
index = 0, element = 1
index = 1, element = 2
index = 2, element = 3
index = 3, element = 4
*/
customerArray.forEachIndexed{index, customer -> println("index = $index, customer = $customer")}
// print on console
// ->
/*
index = 0, customer = Customer(name=Craig, age=45)
index = 1, customer = Customer(name=Amos, age=23)
index = 2, customer = Customer(name=Jack, age=20)
*/