What does + = mean in Visual Basic?

I tried to answer this Google question, but could not find it. I am working on VB.Net. I would like to know what the + = operator means in VB.Net?

+5
source share
5 answers

This means that you want to add a value to an existing variable value. For example:

Dim x As Integer = 1
x += 2  ' x now equals 3

In other words, this would be the same as doing it:

Dim x As Integer = 1
x = x + 2  ' x now equals 3

In the future, you can see the full list of VB.NET statements on MSDN .

+10
source
a += b

equivalently

a = a + b

In other words, it adds the current value.

+5
source

. , , - , ( +), . ,

Dim a As Integer
Dim x As Integer
x = 1
a = 1
x += 2
a = a + 2
if x = a then
MsgBox("This will print!")
endif
+2

2 , , IL-:

x += 1

x = x + 1

+1

-

Dim x as integer = 3

x += 1

'x = 4

x = x + 1

'x = 4

It can also be used with (-):

x -= 1

'x = 2

Same as

x = x - 1

'x = 2

0
source

All Articles