Values in UnrealScript

UnrealScript has various value types including strings, integers, floats, booleans, etc. Here are a few basic examples.

class ValueExample extends Object;

function Example()
{
    // Strings, which can be added together with $
    `log("Unreal" $ "Script");

    // Integers and floats
    `log("1+1 =" @ string(1 + 1));
    `log("7.0/3.0 =" @ string(7.0 / 3.0));

    // Booleans, with boolean operators as you'd expect
    `log(string(true && false));
    `log(string(true || false));
    `log(string(!true));
}

defaultproperties
{
}

To run this code in UnrealScript, you would typically place it in a script file within your Unreal Engine project and then compile and run the project. The output would be visible in the Unreal Engine log.

Here’s what the output might look like:

UnrealScript
1+1 = 2
7.0/3.0 = 2.333333
False
True
False

Note that UnrealScript uses $ for string concatenation and @ for string interpolation. The log function is used for output, wrapped in backticks to indicate it’s a global function. Also, boolean values are converted to strings for logging.

UnrealScript doesn’t have a standalone execution environment like some other languages, so the code would typically be part of a larger Unreal Engine project.