Data type: Long, Char, Hex and Oct : Oct « Data Types « VB.Net






Data type: Long, Char, Hex and Oct

Data type: Long, Char, Hex and Oct
Imports System

Public Class MainClass

    Shared Sub Main(ByVal args As String())
        Dim num_desserts&
        Dim satisfaction_quotient#
        num_desserts = 100
        satisfaction_quotient# = 1.23

        Dim an_integer As Integer = 100
        Dim a_long As Long = 10000000000
        Dim a_double As Double = 1.0

        Dim a_boolean As Boolean = True
        Dim a_date As Date = #12/31/2007#

        Dim i As Long = 123L
        Dim ch As Char = "X"c

        Dim flags As ULong
        flags = 100 ' Decimal 100.
        flags = &H64 ' Hexadecimal &H64 = 6 * 16 + 4 = 96 + 4 = 100.
        flags = &O144 ' Octal &O144 = 1 * 8 * 8 + 4 * 8 + 4 = 64 + 32 + 4 = 100.

        Console.WriteLine(flags)      ' Decimal.
        Console.WriteLine(Hex(flags)) ' Hexadecimal.
        Console.WriteLine(Oct(flags)) ' Octal.

    End Sub

End Class

           
       








Related examples in the same category