- Contoh Penulisan
Dim a(2) As String
a(1) = "Alfa"
a(2) = "Gama"
Console.Write(a(1))
Console.ReadKey()
- Contoh Program Array Statis
Sub Main()
Dim a() As String 'Array Statis
Dim index As Integer
Dim i As Integer
Console.Write("Masukan jumlah index : ")
index = Console.ReadLine
ReDim a(index) 'pendeklarasian ulang variabel array a
For i = 1 To index
Console.Write("Masukan nama ke " & i & ": ")
a(i) = Console.ReadLine
Next
Console.WriteLine()
Console.Write("index ke berapa yang akan di tampilkan : ")
index = Console.ReadLine
Console.Write("di index ke " & index & " Namanya : " & a(index))
Console.ReadKey()
End Sub
Tidak ada komentar:
Posting Komentar