Groovy web console

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

closure default parameter

Published 7 months ago by nmrao with tags default parameter
Actions  ➤ Edit in console Back to console Show/hide line numbers View recent scripts
def myMethod(val = 'test', Closure c) {     
  if(c) c.call()     
  println val 
}
myMethod("print something") {  println "closure1" }
myMethod {  println "closure2" }