I recently realized that VBA also supports an operator +for combining a type String, not just one &. Therefore, if
Dim a As String, b As String
a = "Stack "
b = "Overflow"
The following statements will lead to the same result:
>> a + b '--> "Stack Overflow"
>> a & b '--> "Stack Overflow"
In my limited experience, I have never seen in any language that two operators always do the same. I feel that VBA seeks to merge with other common languages (using only +to concatenate strings), but still supporting &old-school VB developers.
But this is not very similar to the technical explanation, so I would like to ask the following question: is there any practical difference between the two operators? Is there a case where use +, and does not &give a different result?
What I mean
The possible "similar answer", which I mean but cannot find anywhere on the Internet, was inspired by JavaScript, where you can use ==it ===almost everywhere with the same behavior, except that the identifier (===) behaves the same with equality operator (==), except that type conversion is not performed, and types must be the same in order to be considered equal.
source
share