Lambda expressions of C++

C++ provides support for anonymous functions, which are also known as lambda expressions and have the following form:

[capture](parameters) -> return_type { function_body }

Within functions that define a non-void return type, failure to return a value before control reaches the end of the function results in undefined behaviour (compilers typically provide the means to issue a diagnostic in such a case).[36] The sole exception to this rule is the main function, which implicitly returns a value of zero.[37]

[](int x, int y) -> int { return x + y; }