Groovy web console

subscribe to the feed Subscribe
to this
site

IteratingLists

Published 2 weeks ago by Daniel with tags Lists iterating
Actions  ➤ Edit in console Back to console Show/hide line numbers View recent scripts
def lista = [ "a", "b", "c"]
def listb = [ "1", "2", "3"]

log(lista)

log(lista, listb)

def log(List listA){
    listA.each {
        println "$it"
    }
}

def log(List listA, List listB)
{
    listA.each { a ->
        listB.each { b ->
            println "$a + $b"
        }
    }
}