Apache Groovy is the language that should have been called JavaScript because it is a scripting version of Java.
In [ ]:
def a = 1 //local variable
b = 2 //global variable
In [ ]:
a //error
In [ ]:
b //this works
In [ ]:
//closure example
timesTwo = {x -> x*2}
In [ ]:
timesTwo(4)
In [ ]:
timesTwo("Multiplying Strings!")
In [ ]:
sin(3.1415)