Answers for "groovy for loop with index"

1

for loop with index groovy

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
}
Posted by: Guest on May-29-2021

Browse Popular Code Answers by Language