Skip to content

Instantly share code, notes, and snippets.

@kdabir
Last active July 23, 2016 15:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save kdabir/2762107 to your computer and use it in GitHub Desktop.
Save kdabir/2762107 to your computer and use it in GitHub Desktop.
Closures as Varargs in groovy
def hello (...c) {
c.each {it.call()}
}
hello ({println 'hello'},{println 'namaste'}, {println 'hola'})
@fmamud
Copy link

fmamud commented Jul 1, 2016

@kdabir it's missing the ) in the hello method call. :)

https://gist.github.com/fmamud/58fd3060b7f39345f6a6

@kdabir
Copy link
Author

kdabir commented Jul 23, 2016

@fmamud thanks for catching that. Update the gist :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment