-
Notifications
You must be signed in to change notification settings - Fork 0
Closures
Philip Ford edited this page May 28, 2017
·
30 revisions
Groovy closures are true closures, with access to the variables in the context in which they are defined. They are:
-
Contained in braces
-
They are functions.
-
Used in callbacks
-
The default parameter (if you do not provide parameters) is
it.[1,2,3].each { println it }
They can be used a lot like lambdas, passed as parameters to another function. (In other words, they are first-class objects.) But the Groovy documentation insists that they should not be thought of as lambdas.