Tipe Data Dasar di VB.Net
Tipe Data VB.Net - Yosh selamat sore menjelang malam sobs-sobs. semoga keadaan kalian sehat walafiat dan diberikan kenikmatan untuk meminum seutas kopi dan segenggam gorengan.
Pada kesempatan kali ini gua akan bahan tipe data VB.Net, kenapa tipe data ? karena ada basic yang perlu diketahui sebelum lebih jauh kita belajar VB.Net ini.
Oke sebelum ke topik pembahasan sobs-sobs silahkan download Visual Studio di situs resmi microsoft dan pilih comunity edition, kenapa comunity edition tentunya karena itu GRATISS. Visual studio ini merupakan IDE yang akan kita gunakan dalam tutorial VB.Net kedepannya kebetulan gua udah download sobs-sobs yaitu visual studio 2022 comunity edition.
- Setup Project
Jika sudah silahkan sobs-sobs buka visual studionya, jika sudah maka tampilannya akan seperti dibawah ini:
Kemudian selanjutnya beri nama project sesuai dengan keinginan sobs-sobs. kemudian next
dan tahap terahir pilih tombol create
1. Byte
Imports System
Module Program
Sub Main(args As String())
'Tipe Data angka
Dim dataByte As Byte = 10
Console.WriteLine(dataByte)
End Sub
End Module
oh iya untuk membuat komentar kita hanya perlu menggunakan kutip satu saja sobs-sobs seperti contoh diatas.2. SByte
Imports System
Module Program
Sub Main(args As String())
'Tipe Data angka
'1.Byte (0 s/d 255)
Dim dataByte As Byte = 10
Console.WriteLine(dataByte)
'2.SByte (-128 s/d 127)
Dim dataSByte As SByte = -10
Console.WriteLine(dataSByte)
End Sub
End Module
langsung next aja ya sobs biar cepet3. UShort
Imports System
Module Program
Sub Main(args As String())
'Tipe Data angka
'1.Byte (0 s/d 255)
Dim dataByte As Byte = 10
Console.WriteLine(dataByte)
'2.SByte (-128 s/d 127)
Dim dataSByte As SByte = -10
Console.WriteLine(dataSByte)
'3.UShort
Dim dataUShort As UShort = 12000
Console.WriteLine(dataUShort)
End Sub
End Module
Kita next lagi (Kejar setoran)4. Short
Imports System
Module Program
Sub Main(args As String())
'Tipe Data angka
'1.Byte (0 s/d 255)
Dim dataByte As Byte = 10
Console.WriteLine(dataByte)
'2.SByte (-128 s/d 127)
Dim dataSByte As SByte = -10
Console.WriteLine(dataSByte)
'3.UShort
Dim dataUShort As UShort = 12000
Console.WriteLine(dataUShort)
'4.Short
Dim dataShort As Short = -12000
Console.WriteLine(dataShort)
End Sub
End Module
Sipp, Selanjutnya5. UInteger
Imports System
Module Program
Sub Main(args As String())
'Tipe Data angka
'1.Byte (0 s/d 255)
Dim dataByte As Byte = 10
Console.WriteLine(dataByte)
'2.SByte (-128 s/d 127)
Dim dataSByte As SByte = -10
Console.WriteLine(dataSByte)
'3.UShort
Dim dataUShort As UShort = 12000
Console.WriteLine(dataUShort)
'4.Short
Dim dataShort As Short = -12000
Console.WriteLine(dataShort)
'5.UInteger
Dim dataUInteger As UInteger = 30000
Console.WriteLine(dataUInteger)
End Sub
End Module
Next sobs
6. Integer
Imports System
Module Program
Sub Main(args As String())
'Tipe Data angka
'1.Byte (0 s/d 255)
Dim dataByte As Byte = 10
Console.WriteLine(dataByte)
'2.SByte (-128 s/d 127)
Dim dataSByte As SByte = -10
Console.WriteLine(dataSByte)
'3.UShort
Dim dataUShort As UShort = 12000
Console.WriteLine(dataUShort)
'4.Short
Dim dataShort As Short = -12000
Console.WriteLine(dataShort)
'5.UInteger
Dim dataUInteger As UInteger = 30000
Console.WriteLine(dataUInteger)
'6.Integer
Dim dataInteger As Integer = -30000
Console.WriteLine(dataInteger)
End Sub
End Module
Lumayan pegel nih sobs, oke next aja ya lah
7. ULong
Imports System
Module Program
Sub Main(args As String())
'Tipe Data angka
'1.Byte (0 s/d 255)
Dim dataByte As Byte = 10
Console.WriteLine(dataByte)
'2.SByte (-128 s/d 127)
Dim dataSByte As SByte = -10
Console.WriteLine(dataSByte)
'3.UShort
Dim dataUShort As UShort = 12000
Console.WriteLine(dataUShort)
'4.Short
Dim dataShort As Short = -12000
Console.WriteLine(dataShort)
'5.UInteger
Dim dataUInteger As UInteger = 30000
Console.WriteLine(dataUInteger)
'6.Integer
Dim dataInteger As Integer = -30000
Console.WriteLine(dataInteger)
'7.ULong
Dim dataULong As ULong = 12000000
Console.WriteLine(dataULong)
End Sub
End Module
haaah, next again.
8. Long
Imports System
Module Program
Sub Main(args As String())
'Tipe Data angka
'1.Byte (0 s/d 255)
Dim dataByte As Byte = 10
Console.WriteLine(dataByte)
'2.SByte (-128 s/d 127)
Dim dataSByte As SByte = -10
Console.WriteLine(dataSByte)
'3.UShort
Dim dataUShort As UShort = 12000
Console.WriteLine(dataUShort)
'4.Short
Dim dataShort As Short = -12000
Console.WriteLine(dataShort)
'5.UInteger
Dim dataUInteger As UInteger = 30000
Console.WriteLine(dataUInteger)
'6.Integer
Dim dataInteger As Integer = -30000
Console.WriteLine(dataInteger)
'7.ULong
Dim dataULong As ULong = 12000000
Console.WriteLine(dataULong)
'8.Long
Dim dataLong As Long = -12000000
Console.WriteLine(dataLong)
End Sub
End Module
Oke, dengan ini tipe data bilangan bulat bisa dikatakan selesai sobs. selanjutnya kita masih berkutik dengan tipe data angka yaitu tipe data bilangan decimal atau koma-koma club.
9. Double
Imports System
Module Program
Sub Main(args As String())
'Tipe Data angka
'1.Byte (0 s/d 255)
Dim dataByte As Byte = 10
Console.WriteLine(dataByte)
'2.SByte (-128 s/d 127)
Dim dataSByte As SByte = -10
Console.WriteLine(dataSByte)
'3.UShort
Dim dataUShort As UShort = 12000
Console.WriteLine(dataUShort)
'4.Short
Dim dataShort As Short = -12000
Console.WriteLine(dataShort)
'5.UInteger
Dim dataUInteger As UInteger = 30000
Console.WriteLine(dataUInteger)
'6.Integer
Dim dataInteger As Integer = -30000
Console.WriteLine(dataInteger)
'7.ULong
Dim dataULong As ULong = 12000000
Console.WriteLine(dataULong)
'8.Long
Dim dataLong As Long = -12000000
Console.WriteLine(dataLong)
'9.Double
Dim dataDouble As Double = -3.14
Console.WriteLine(dataDouble)
End Sub
End Module
Oh iya tipe data ini bersifat (signed) artinya bisa kita berikan nilai negatif ya sobs.10. Decimal
Imports System
Module Program
Sub Main(args As String())
'Tipe Data angka
'1.Byte (0 s/d 255)
Dim dataByte As Byte = 10
Console.WriteLine(dataByte)
'2.SByte (-128 s/d 127)
Dim dataSByte As SByte = -10
Console.WriteLine(dataSByte)
'3.UShort
Dim dataUShort As UShort = 12000
Console.WriteLine(dataUShort)
'4.Short
Dim dataShort As Short = -12000
Console.WriteLine(dataShort)
'5.UInteger
Dim dataUInteger As UInteger = 30000
Console.WriteLine(dataUInteger)
'6.Integer
Dim dataInteger As Integer = -30000
Console.WriteLine(dataInteger)
'7.ULong
Dim dataULong As ULong = 12000000
Console.WriteLine(dataULong)
'8.Long
Dim dataLong As Long = -12000000
Console.WriteLine(dataLong)
'9.Double
Dim dataDouble As Double = -3.14
Console.WriteLine(dataDouble)
'10.Decimal
Dim dataDecimal As Decimal = 10000.9001
Console.WriteLine(dataDecimal)
End Sub
End Module
Sipp selanjutnya kita akan hempaskan tipe data angka
11. Boolean
Imports System
Module Program
Sub Main(args As String())
'Tipe Data angka
'1.Byte (0 s/d 255)
Dim dataByte As Byte = 10
Console.WriteLine(dataByte)
'2.SByte (-128 s/d 127)
Dim dataSByte As SByte = -10
Console.WriteLine(dataSByte)
'3.UShort
Dim dataUShort As UShort = 12000
Console.WriteLine(dataUShort)
'4.Short
Dim dataShort As Short = -12000
Console.WriteLine(dataShort)
'5.UInteger
Dim dataUInteger As UInteger = 30000
Console.WriteLine(dataUInteger)
'6.Integer
Dim dataInteger As Integer = -30000
Console.WriteLine(dataInteger)
'7.ULong
Dim dataULong As ULong = 12000000
Console.WriteLine(dataULong)
'8.Long
Dim dataLong As Long = -12000000
Console.WriteLine(dataLong)
'9.Double
Dim dataDouble As Double = -3.14
Console.WriteLine(dataDouble)
'10.Decimal
Dim dataDecimal As Decimal = 10000.9001
Console.WriteLine(dataDecimal)
'11.Boolean
Dim dataBenar As Boolean = True
Dim dataSalah As Boolean = False
Console.WriteLine(dataBenar)
Console.WriteLine(dataSalah)
End Sub
End Module
Selanjutnya.12. Char
Imports System
Module Program
Sub Main(args As String())
'Tipe Data angka
'1.Byte (0 s/d 255)
Dim dataByte As Byte = 10
Console.WriteLine(dataByte)
'2.SByte (-128 s/d 127)
Dim dataSByte As SByte = -10
Console.WriteLine(dataSByte)
'3.UShort
Dim dataUShort As UShort = 12000
Console.WriteLine(dataUShort)
'4.Short
Dim dataShort As Short = -12000
Console.WriteLine(dataShort)
'5.UInteger
Dim dataUInteger As UInteger = 30000
Console.WriteLine(dataUInteger)
'6.Integer
Dim dataInteger As Integer = -30000
Console.WriteLine(dataInteger)
'7.ULong
Dim dataULong As ULong = 12000000
Console.WriteLine(dataULong)
'8.Long
Dim dataLong As Long = -12000000
Console.WriteLine(dataLong)
'9.Double
Dim dataDouble As Double = -3.14
Console.WriteLine(dataDouble)
'10.Decimal
Dim dataDecimal As Decimal = 10000.9001
Console.WriteLine(dataDecimal)
'11.Boolean
Dim dataBenar As Boolean = True
Dim dataSalah As Boolean = False
Console.WriteLine(dataBenar)
Console.WriteLine(dataSalah)
'12.Char
Dim dataChar As Char = "A"
Console.WriteLine(dataChar)
End Sub
End Module
Nah, berikutnya mungkin kedepannya tipe data yang paling sering akan dipakai13. String
Imports System
Module Program
Sub Main(args As String())
'Tipe Data angka
'1.Byte (0 s/d 255)
Dim dataByte As Byte = 10
Console.WriteLine(dataByte)
'2.SByte (-128 s/d 127)
Dim dataSByte As SByte = -10
Console.WriteLine(dataSByte)
'3.UShort
Dim dataUShort As UShort = 12000
Console.WriteLine(dataUShort)
'4.Short
Dim dataShort As Short = -12000
Console.WriteLine(dataShort)
'5.UInteger
Dim dataUInteger As UInteger = 30000
Console.WriteLine(dataUInteger)
'6.Integer
Dim dataInteger As Integer = -30000
Console.WriteLine(dataInteger)
'7.ULong
Dim dataULong As ULong = 12000000
Console.WriteLine(dataULong)
'8.Long
Dim dataLong As Long = -12000000
Console.WriteLine(dataLong)
'9.Double
Dim dataDouble As Double = -3.14
Console.WriteLine(dataDouble)
'10.Decimal
Dim dataDecimal As Decimal = 10000.9001
Console.WriteLine(dataDecimal)
'11.Boolean
Dim dataBenar As Boolean = True
Dim dataSalah As Boolean = False
Console.WriteLine(dataBenar)
Console.WriteLine(dataSalah)
'12.Char
Dim dataChar As Char = "A"
Console.WriteLine(dataChar)
'13.String
Dim dataString As String = "Sruputkode pancen oyee"
Console.WriteLine(dataString)
End Sub
End Module
Nah, itu merupakan tipe dasar dari vb.net sebenarnya ada beberapa data lagi sobs-sobs seperti Date dan Object, namun itu akan gua bahas secara tepisah ya sobs-sobs.
Posting Komentar untuk "Tipe Data Dasar di VB.Net"
Posting Komentar