Groovy web console

subscribe to the feed Subscribe
to this
site

grr

Published 2 months ago by ms
Actions Execute script  ▶ Edit in console Back to console Show/hide line numbers View recent scripts
def ingest(val) {     println(val) }  

Map<String,Closure> map = [:]

int LEVEL = 4;
def ints = [""] * LEVEL

ints.eachWithIndex{
    val, index ->  map[index] = { ingest(index) } 
}

map[0]()
map[1]()
map[2]()
map[3]()