Compact operators


Public Class Tester

Public Shared Sub Main
Dim result As New System.Text.StringBuilder

Dim testDouble As Double = Math.PI
result.Append(“Double “).AppendLine(testDouble)
testDouble += Math.PI
result.Append(“+= “).AppendLine(testDouble)
testDouble *= Math.PI
result.Append(“*= “).AppendLine(testDouble)
testDouble -= Math.PI
result.Append(“-= “).AppendLine(testDouble)
testDouble /= Math.PI
result.Append(“/= “).AppendLine(testDouble)
testDouble ^= Math.PI
result.Append(“^= “).AppendLine(testDouble)
result.AppendLine()

Dim testInteger As Integer = 17
result.Append(“Integer “).AppendLine(testInteger)
testInteger \= 2
result.Append(“\= 2 … “).AppendLine(testInteger)
testInteger += 1
result.Append(“+= 1 … “).AppendLine(testInteger)
testInteger <<= 1
result.Append(“<<= 1 … “).AppendLine(testInteger)
testInteger >>= 3
result.Append(“>>= 3 … “).AppendLine(testInteger)
result.AppendLine()

Dim testString As String = “Abcdef”
result.Append(“String “).AppendLine(testString)
testString &= “ghi”
result.Append(“&= ghi … “).AppendLine(testString)
testString += “jkl”
result.Append(“+= jkl … “).AppendLine(testString)

Console.WriteLine(result.ToString())

End Sub
End Class

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s