Our first example demonstrates functions in UnrealScript. We’ll explore functions with a few different examples.
To run this code in UnrealScript, you would typically include it in a larger project and call the ExecuteExample function. The output would be logged to the Unreal Engine log:
UnrealScript has some differences from other languages:
Functions are defined within a class.
The static keyword is used for functions that don’t require an instance of the class.
Local variables are declared with the local keyword.
String concatenation uses the @ operator.
Logging is done with the `log command.
UnrealScript doesn’t have a direct equivalent to multiple return values, but you can achieve similar functionality using out parameters or struct returns.
[Next Example: Multiple Return Values (or equivalent concept in UnrealScript)]