Mega Code Archive

 
Categories / VB.Net Tutorial / Operator
 

Shortcut assignment operators

Module Tester     Sub Main()         Dim A As Integer         A = 0         A += 10         Console.WriteLine("A += 10 yields " & A)         A -= 5         Console.WriteLine("A -=5 yields " & A)         A *= 3         Console.WriteLine("A *= 3 yields " & A)         A /= 5         Console.WriteLine("A /= 5 yields " & A)         A ^= 2         Console.WriteLine("A = 2 yields " & A)     End Sub End Module A += 10 yields 10 A -=5 yields 5 A *= 3 yields 15 A /= 5 yields 3 A ^= 2 yields 9