Groovy web console

subscribe to the feed Subscribe
to this
site

Iterate over list indexes and values

Published 2 years ago by Valentin
Actions Execute script  ▶ Edit in console Back to console Show/hide line numbers View recent scripts
items = ['aaa', 'bbb', 'ccc']

items.eachWithIndex {
  x, i -> println "Item $i = $x"
}