Published
- 1 min read
for loop with index groovy
The solution for this is noted below
for loop with index groovy
Solution
def list = [1,2,5,7]
list.each{
println it
}
list.each{val->
println val
}
list.eachWithIndex{it,index->
println "value " + it + " at index " +index
}
Try other methods by searching on the site. That is if this doesn’t work