Conceptual
Login

Closures

A closure is a function bundled with the variables from its defining scope, which it can read and update after that scope has exited — the mechanism that lets returned and callback functions carry private state.

Questions this Concept answers

  • Why does an API take a closure instead of asking the caller to do the work itself before and after calling in?