Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What does += mean in Visual Basic?

I tried to google the answer for this but could not find it. I am working on VB.Net. I would like to know what does the operator += mean in VB.Net ?

like image 460
HereToLearn_ Avatar asked Dec 01 '22 04:12

HereToLearn_


2 Answers

It means that you want to add the value to the existing value of the variable. So, for instance:

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

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

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

For future reference, you can see the complete list of VB.NET operators on the MSDN.

like image 158
Steven Doggart Avatar answered Dec 02 '22 16:12

Steven Doggart


a += b

is equivalent to

a = a + b

In other words, it adds to the current value.

like image 27
Carlos Vergara Avatar answered Dec 02 '22 18:12

Carlos Vergara