<< Prev        Next >>

ID : 574

Data Type Priority in Dyadic Operation

If data of a different data type are designated in a dyadic operation, operation is normally performed after conversion into higher priority data described below.

Priority Data type
1 Double precision real number type
2 Single precision real number type
3 Integer type
4 String type
5 Vector type
Position type

Joint type

Homogeneous translation type

Operation Example

Example 1
Dim aaa As Integer
Dim bbb As String
aaa = 100
bbb = "DENSO"
PringDbg aaa + bbb 
'The Integer aaa has higher priority so String bbb is automatically converted into Integer
'bbb cannot be converted into Integer, so an error occurs
Example 2
Dim aaa As Integer
Dim bbb As String
aaa = 100
bbb = "90"
PringDbg aaa + bbb 
'The Integer aaa has higher priority so String bbb is automatically converted into Integer
'190 is output
Example 3
Dim aaa As Position
Dim bbb As String
aaa = P(100, 200, 300)
bbb = "90"
PringDbg bbb + aaa
'The String bbb has higher priority so Position aaa is automatically converted into String
' "90P(100, 200, 300, 0, 0, 0, -1)" is output

Attention

In case of string concatenation operator "& operator;" both sides are compulsorily and automatically converted into string type regardless of the priority.

ID : 574

<< Prev        Next >>