Fun With Anonymous Methods: Using Higher-Order Functions in Delphi

Since 2009, the Delphi language (or better, its Object Pascal dialect) has supported anonymous methods.
What Is an Anonymous Method?
Not surprisingly, an anonymous method is a procedure or a function that does not have an associated name. An anonymous method treats a block of code just like a value so that it can be assigned to a variable, used as a parameter to a method, or returned by a function as its result value.