Tinderbox v9 Icon

+ (i.e. string concatenation)

Operator Type: 

Operator Scope of Action: 

Operator Purpose: 

Operator First Added: 

Operator Last Altered: 

 Operator  [other Operator type actions]

 Item  [operators of similar scope]

 Mathematical  [other Mathematical operators]


 As at baseline

+ (i.e. string concatenation)

The concatenation operator, + (plus sign character), joins the strings/references/expressions before and after it. Thus, the expression

$FullName = $FirstName+" "+$LastName; 

evaluates a first name "Jane" and last name "Doe" to give a string value "Jane Doe" for the FullName attribute. If the right-side code in more complex, consider adding parentheses to help signal user intent to Tinderbox.

Mixing data types

If the right side inputs mix text and numbers—they need treating as numbers (even if stored in strings)—see more on concatenation versus addition.

The + (plus sign) character is also used for numerical addition. Depending on context, Tinderbox will decided which operation is intended by the + sign. This is a very good reason to always enclose literal text strings in quotes.

Concatenating Lists (List & Set type data)

Note that here both List-type and Set-type attributes can be considered the same as data sources, i.e. right-side inputs.

To concatenate lists, it might appear logical to do this:

$MyList = $SomeList+$SomeSet; WRONG!

The result is no value is passed to $MyList. When adding lists to lists there are a variety of approaches. Note that depending on the nature of the task, and the method below that is used, it may first be necessary to reset the receiving list to the default (empty) value.

Use the '+=' increment operator:

$MyList += $SomeList+$SomeSet;

Add to the existing list (older older style—use the above method):

$MyList = $MyList + $SomeList+$SomeSet;

Or, if if intentionally replacing current $MyList values with new ones, this may be used:

$MyList = ($SomeList+$SomeSet);

The additional parentheses help Tinderbox to understand all the right-side lists need to be made into one list before being passed to the left-side.