An anonymous function is a function literal that has no direct identifier. They are used in shortening code. A downside to these functions are that you can only use them in the expression they're formed in.
An anonymous function used with connect:
The above code is shorter than defining a named function, like such:
Anonymous functions are most commonly used in chat scripts or compound event scripts. These are used so that the arguments from the current function are still accessible. Example:
If you wanted to have the function in the Chatted connection to have a name, you would still have to use an anonymous function. It wouldn't need to be nearly as long as the actual message-processing code though:
This is useful for shortening code, however this should be avoided in code that runs more than once. This is because the function is being defined more than once, which is unneeded because it is a literal function that is unchanging. These functions should be semantically named and used as such.