<< Prev        Next >>

ID : 625

+ Operator

Function

To return the sum of 2 numeric values, the string concatenation or the sum of each element in vector type data and joint type data.

Syntax

expression1 + expression2

Guaranteed entry

expression1
Designate numeric data, string type data, vector type data or joint type data.
expression2
Designate numeric data, string type data, vector type data or joint type data.

Return value

The sum of numeric values, the string concatenation or the sum of vector type data and joint type data elements are returned.

Description

The sum of numeric values, the string concatenation or the sum of vector type data and joint type data elements are returned.

Either of the following types of operation is performed depending on argument combination.

Sum of numeric values

The sum of numeric values is returned when every argument is numeric data. It is returned by data type with higher argument priority.

Dim aaa As Integer, bbb As Single
aaa = 1000
bbb = 1234.567
PrintDbg aaa + bbb '2234.567 is output.
String concatenation

The result of argument string concatenation is returned when every argument is string type data.

Dim aaa As String, bbb As String
aaa = "DENSO"
bbb = "ROBOT"
PrintDbg aaa + " " + bbb '"DENSO ROBOT" is output.
Sum of vector type data components

The sum of vector type data elements is returned by vector type data, when every argument is vector type data.

When vector type data VecA: V(Xa, Ya, Za) and VecB: V(Xb, Yb, Zb) are given, the retrun value is

ResultVec: V(Xa + Xb, Ya + Yb, Za + Zb).

Dim aaa As Vector, bbb As Vector
aaa = V(100, 200, 300)
bbb = V(10, 10, 10)
PrintDbg aaa + bbb ' V(110, 210, 310) is output
Sum of joint type data components

The sum of elements is returned by joint type data when every argument is joint type data.

Joint type data JntA: J(Ax1a, Ax2a, Ax3a, Ax4a, Ax5a, Ax6a, Ax7a, Ax8a),
JntB: When J(Ax1b, Ax2b, Ax3b, Ax4b, Ax5b, Ax6b, Ax7b, Ax8b) is given, the return value is

ResultJnt: J(Ax1a + Ax1b , Ax2a + Ax2b, Ax3a + Ax3b, Ax4a + Ax4b, Ax5a + Ax5b, Ax6a + Ax6b, Ax7a + Ax7b, Ax8a + Ax8b).

Dim aaa As Joint, bbb As Joint
aaa = J(50, 100, 150, 200, 250, 300, 350, 400)
bbb = J(11, 12, 13, 14, 15, 16, 17, 18)
PrintDbg aaa + bbb ' J(61, 112, 163, 214, 265, 316, 367, 418) is output

Attention

With the + operator, it may be unsure which of addition or string concatenation is performed in advance. To eliminate ambiguity of the code and make it easy to understand, use the & operator for concatenation of string.

Numeric data and vector type data cannot be combined.

Process the deveation calculation of position type data by Dev.

Example

-

ID : 625

<< Prev        Next >>