Operator + Foundation

Plus operator (unary): defines the sign of numeric values. Plus operator (binary): numeric addition or string concatenation.

Syntax
<nValue1>  + <nValue2>   // addition
<dDate>    + <nValue>    // addition
<nValue>   + <dDate>     // addition
<cString1> + <cString2>  // string concatenation
Parameters
<nValue1>
<nValue1> and <nValue2> are numeric expressions. The value of <nValue2> is added to the value of <nValue1>.
<dDate>
<dDate> is an expression with data type date, to which the numeric number of days <nValue> is added.
<cString1>
<cString1> and <cString2> are character expressions. The value of <cString2> is concatenated (attached) to the end of <cString1>.
Description

The operations of the plus operator are dependent on the program context and on the data types of the operands:

When a unary plus operator is placed in front of a numeric expression, it corresponds to a multiplication with the value +1. The plus operator does not actually execute an operation with the operand in this case, but raises the precedence of the operation in relation to other numeric operators with the exception of the unary minus operator.

When the binary plus operator is used with two numeric expressions <nValue1> and <nValue2>, the value of the right expression <nValue2> it added to the value of the left expression <nValue1>. The result of the addition is the numeric value which is the sum of the two expressions.

If one operand is a date expression and the other is a numeric expression, the number of days <nValue> is added to the value of the date expression <dDate>. The result is a date value.

When the binary plus operator is used with two character expressions <cString1> and <cString2>, the character sting on the right is attached to the end of the character string on the left <cString1>. The result is the concatenated character string.

Examples
The plus operator (+)
// This example shows various results of the plus operator. 

PROCEDURE Main 

   ?  4 + 4                         // result: 8 
   ? +4 - 4                         // result: 0 

   ? CtoD("12/31/94") + 6           // result: 01/06/95 
   ? 6 + CtoD("12/31/94")           // result: 01/06/95 

   ? "James " + "Bond"              // result: James Bond 

   ? "Bond" + "James"               // result: BondJames 

RETURN 
Feedback

If you see anything in the documentation that is not correct, does not match your experience with the particular feature or requires further clarification, please use this form to report a documentation issue.