Groovy web console

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

get dynamic varname

Published 9 months ago by Anonymous
Actions  ➤ Edit in console Back to console Show/hide line numbers View recent scripts
def varname = "foo"
def foo = 1
new GroovyShell(this.binding).evaluate("newvar = ${varname}") // error: no such property foo
println newvar // should print 1