Grails index of each
groovy
Solution
You can use eachWithIndex:
arr.eachWithIndex { obj, i ->
println "${i}: ${obj}"
}
Problem
I've the following codes in my controller. How do I access the each index? ``` def arr = ['a', 'b', 'c'] arr.each { // 'it' is the element println it } ```