Compact operators : Operator « Operator « VB.Net Tutorial

Home
VB.Net Tutorial
1.Language Basics
2.Data Type
3.Operator
4.Statements
5.Date Time
6.Class Module
7.Development
8.Collections
9.Generics
10.Attributes
11.Event
12.LINQ
13.Stream File
14.GUI
15.GUI Applications
16.Windows Presentation Foundation
17.2D Graphics
18.I18N Internationlization
19.Reflection
20.Regular Expressions
21.Security
22.Socket Network
23.Thread
24.Windows
25.XML
26.Database ADO.net
27.Design Patterns
VB.Net
VB.Net by API
VB.Net Tutorial » Operator » Operator 
3.1.1.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
Double 3.14159265358979
+= 6.28318530717959
*= 19.7392088021787
-= 16.5976161485889
/= 5.28318530717959
^= 186.656996003562

Integer 17
\= 2 ... 8
+= 1 ... 9
<<= 1 ... 18
>>= 3 ... 2

String Abcdef
&= ghi ... Abcdefghi
+= jkl ... Abcdefghijkl
3.1.Operator
3.1.1.Compact operators
3.1.2.Using an assignment operator to calculate a power of 2
3.1.3.Calculate PI
3.1.4.Prime numbers using the Sieve of Eratosthenes
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.