Groovy web console

subscribe to the feed Subscribe
to this
site

Closure Mix

Published 2 months ago by Dave
Actions  ➤ Edit in console Back to console Show/hide line numbers View recent scripts
def adder ={x,y=10->return x+y}
println(adder(3,2))
println(adder(8))

def numparams(Closure closure){
closure.getMaximumNumberOfParameters()
}
println numparams{one->}


def typeparams(Closure closure){
closure.getParameterTypes()
}
println typeparams{Number n,Dated->}