Imports System
Public Module TWOArrays_1
Public Sub Main()
'two dimension()
Dim Students(3, 1) As String
Students(0, 0) = "Zonk"
Students(0, 1) = "A"
Students(1, 0) = "Billy"
Students(1, 1) = "B"
Students(2, 0) = "Silly"
Students(2, 1) = "E"
Students(3, 0) = "Gonk"
Students(3, 1) = "C"
'' write out
'Dim x, y As Integer 'nested For loop
'' output each array element's value '
For x = 0 To 3 'works but not good - use getupperbound
For y = 0 To 1 'works but not good
Console.WriteLine("At Position [{0},{1}] = {2}", x, y, Students(x, y))
Next y
Next x
'For x = 0 To Students.GetUpperBound(0)
' For y = 0 To Students.GetUpperBound(1)
'' Console.WriteLine("At Position [{0},{1}] = {2}", x, y, Students(x, y))
' Next y
' Next x
' an array with 5 rows and 2 columns
Dim a(,) As Integer = {{0, 0}, {1, 2}, {2, 4}, {3, 6}, {4, 8}}
Dim i, j As Integer
' output each array element's value '
For i = 0 To 4
For j = 0 To 1
Console.WriteLine("a[{0},{1}] = {2}", i, j, a(i, j))
Next j
Next i
Console.ReadLine()
End Sub
End Module