Basic Syntax

Lambda Expression

English

Overview

A concise way to define a function on the spot without giving it a name.

Details

A mechanism for writing an anonymous function with concise syntax, commonly used to pass as an argument to a higher-order function. Because it captures and keeps referencing variables from the enclosing scope, it effectively behaves like a closure -- a common pitfall is capturing a loop variable, where each call ends up referencing a value different from what was intended.

More Programming terms