In Javascript, you can define an anonymous function that can be executed immediately. It is called an Immediate Invocation Function Expression, aka IIFE.
First, you declare the function, like so:
function () { console.log('Immediately invoked function execution'); }
Then, you wrap it up in ():
(function () { console.log('Immediately invoked function execution'); })
Finally, you add another () to execute it:
(function () { console.log('Immediately invoked function execution'); })()
In Delphi, similarly, you can define an anonymous method:
procedure begin WriteLn('Hello world'); end
Then, you wrap it up with ():
(procedure begin WriteLn('Hello world'); end)
And finally, execute it!
(procedure begin WriteLn('Hello world'); end)();
Here's another example:
WriteLn((function (const X: string): Boolean begin WriteLn(X); Result := True; end)('Hello'));
The output for this shows the following x:
HelloTRUE
How to free more space on your home drive by redirecting the location for SDKs in RAD Studio
Learn the command line used to compile System.pas in Delphi
A method to design records so that they're allocated on a specific byte boundary, such as 16 bytes, 512 bytes, 4096 bytes, etc.
Learn why the map is cool in Go!