groovy beginner- how to remove a variable from memory in groovy shell

6.7k views Asked by At

I could not see any method to remove a variable from memory in Groovy shell... is this possible? How do I do this? I can see methods for doings this in Beanshell and Javascript(Rhino) but not in Groovy.

1

There are 1 answers

0
tim_yates On

I believe you can do:

binding.variables.remove 'varname'

Or, if you want to remove all variables, then

purge variables

should work as well