In Tinderbox, the plus symbol (+) is used both to concatenate (join) strings of text and to sum figures. Thus
$MyString = "My favourite colour is " + $FavouriteColour
$MyNumber = 4 + 3
Nothing untoward there, not least as the target data type (as implied here by the left side attribute name) helps Tinderbox guess the user's intent. But what about:
$MyString = "6" + 4
Is it "64", 64, "10" or 10? As the target attribute is String-type, the result is a string. As one of the right side arguments is a string, then a concatenation is used. If both (all) arguments are numbers, then an addition occurs before being saved as a string:
$MyString = "6" + 4
gives "64"
$MyString = 6 + 4
gives "10"
$MyString = 6 + "4"
gives "64"
$MyString = "6" + "4"
gives "64"
In earlier versions of Tinderbox, there was no need to quote strings and Tinderbox guessed string/number by context. Since then, as the action code has got richer, it has become harder to divine the user's intent, thus the move to expecting text to be placed in double quotes. Incidentally it also makes it easier to indicate intent with regard to leading/trailing white space.
Thus, when using the '+' operator try to ensure Tinderbox isn't having to guess too hard as to the desired outcome.
Dates and Strings
Expressions in which a date is added to a string. In the following the value of $Name is "Created"
$String=$Name + $Created
<- a string "Created08/07/2010 08:27"
$String=$Name + " " + $Created
<- a string "Created 08/07/2010 08:27"
Previous to v5.1.0, the string and date were coerced to a number. In the above example the date time format is the user's host OS short date/time format so will vary by locale. The date shown equates to format($Date,"l t") - i.e. local short date space local time (see format(), date formats). Use format() with the date attribute if some other date/time formatting is required.
Note also above how a joining space needs to be provided. Previous to v5.5.4 using space alone in a string caused the space to be trimmed; in such circumstance store the space in an attribute and call the latter in place of " ".
Note that adding a string to a date continues to return a date, adding a date to a string returns a string:
$Date+"3 days"
<- a date: 3/29/10
"3 Days "+$Date
<- a string: 3 Days 3/26/10
"3 Days"+" "+$Date
<- a string: 3 Days 3/26/10
The first above assumes the string being added contains logical date-related content.