vb裡的arr函式是陣列。舉例說明如下:Private Sub Command1_Click() Dim arr(5) As Integer, arr1(5) As Integer "宣告兩個一維數字 n = 3 "賦值 For i = 1 To 5 "迴圈開始:從1迴圈到5 arr(i) = i "陣列元素賦值 arr1(n) = 2 * n + i "同上 Next "迴圈結束 Print arr1(n); arr(n) "輸出陣列元素的值End Sub結果:11 3
vb裡的arr函式是陣列。舉例說明如下:Private Sub Command1_Click() Dim arr(5) As Integer, arr1(5) As Integer "宣告兩個一維數字 n = 3 "賦值 For i = 1 To 5 "迴圈開始:從1迴圈到5 arr(i) = i "陣列元素賦值 arr1(n) = 2 * n + i "同上 Next "迴圈結束 Print arr1(n); arr(n) "輸出陣列元素的值End Sub結果:11 3