Groovy web console

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

TestThisInClosure2

Published 1 month ago by Ashok Kallarakuzhi
Actions  ➤ Edit in console Back to console Show/hide line numbers View recent scripts
def runClosure(
    closure
) {
    def nestedClosure = { x -> 
            println "Current value of this.class.name: ${this.class.name}"
            x()}
    closure()
    nestedClosure(closure)

}

runClosure { println this.class.name}