Groovy web console

subscribe to the feed Subscribe
to this
site
eli (via #groovywebconsole)
tweet this snippet Tweet
this
script

eli

Published 1 month ago by as
Actions  ➤ Edit in console Back to console Show/hide line numbers View recent scripts
//create a list (aka arraylist) of strings
def x = new ArrayList<String>();

// add items to the  list
x.add("eli");
x.add("as");

//loop each item in the list
x.each {     
    println "Item: $it" // `it` is an implicit parameter corresponding to the current element 
}