Revision: 10488
Initial Code
Initial URL
Initial Description
Initial Title
Initial Tags
Initial Language
at January 2, 2009 10:54 by callmeblessed
Initial Code
// index started with 0
def x= [1,2,3,445,6];
x.eachWithIndex{ obj, index ->
println("${index}. ${obj}");
}
Initial URL
Initial Description
how to loop an array / collection / list but with index. instead of using each{} closure, you can use eachWithIndex{} closure
Initial Title
looping with index
Initial Tags
groovy
Initial Language
Groovy