Automatic type conversion
dBASE Plus features automatic type conversion between its simple data types. When a particular type is expected, either as part of an operation or because a property is of a particular type, automatic conversion may occur. In particular, both numbers and logical values are converted into strings, as shown in the following examples:
"There are " + 6 * 2 + " in a dozen" // The string "There are 12 in a dozen"
"" + 4 // The string "4"
"2 + 2 equals 5 is " + ( 2 + 2 == 5 ) // The string "2 + 2 equals 5 is false"
As shown above, to convert a number into a string, simply add the number to an empty string. Be careful, though; the following expression doesn’t work as you might expect:
"The answer is " + 12 + 1 // The string "The answer is 121"
The number 12 is converted to a string and concatenated, then the number 1 is converted and concatenated, yielding "121". To concatenate the sum of 12 plus 1, use parentheses to force the addition to be performed first:
"The answer is " + (12 + 1) // The string "The answer is 13"