Table of Contents

String Variables

String variables can be added together (concatenated) and tested for equality/inequality.

Adding Strings

Concatenating strings is the only allowed arithmetic operation on string variables.

var str1 = Var.Define("str1", "A long, long time ago ...");
var str2 = Var.Define("str2", " in a galaxy far, far away.");

On.Ready(str1.Add(str2), Debug.Log(str1));

This will log:

A long, long time ago ... in a galaxy far, far away.

Comparing Strings

String variables can also be tested for equality and inequality:

var message = Var.Define("peace", "We come in peace!");

On.Ready(If(message != "We come in peace!")
        .Then(Debug.Log("You'll leave in pieces!"))
        .Else(Debug.Log("Welcome, friends!"))
);

Other Operations: ERROR

Caution

All other arithmetic operations and comparisons on string variables will be an error.