Closures are self contained blocks of functionality that can be passed around your code that can capture and store reference to any variables or constants from the context in which they are defined.
Closures can take one of the three following forms:
- Global functions that have a name but do not capture any values .
- Nested functions that have a name but capture values from surrounding context.
- Closure expressions are unnamed closures written in light-weight syntax that can capture and store reference from surrounding context.