-= Operator

  • Thread starter Thread starter Thorsten Adams
  • Start date Start date
T

Thorsten Adams

Hi to all, I have been desperatly trying to find out what the -=
operator does. The funny thing is that Google doesn't allow -= in its
queries, so it's hard to find...
 
Thorsten Adams said:
Hi to all, I have been desperatly trying to find out what the -= operator
does. The funny thing is that Google doesn't allow -= in its queries, so
it's hard to find...

For example

Dim i as integer = 66
dim j as integer = 33

i -= 22 ' which is same as i = i - 22
j += 33 ' which is same as j = j + 33

' i now = 44
' j now = 66
 
as addition to Les Hay


These operators are often found in loop constructs

dim i as integer


do while blabla

i+=1 ( corresponds to i = i + 1)
i-=1 ( corresponds to i = i - 1)

Loop

it just saves you some typing

regards

Michel
 
These operators are often found in loop constructs

dim i as integer


do while blabla

i+=1 ( corresponds to i = i + 1)
i-=1 ( corresponds to i = i - 1)

Loop

it just saves you some typing

In loops is better again

i++
i--

for (int i = 0; i < 10; i++)

:)
 
Back
Top