Local a:Int[][] = [[1,2,3],[4,5],[6,7,8,9]] For i = 0 To (a.length - 1) For j = 0 To (a[i].length- 1) Print a[i][j] Next Print Next
Here you see that subarrays really can have different amounts of indexes.
With this code, the first index of a[] has 3 values, as stated with the number of blocks ([...]) inside the whole block.
You see that there are 3 blocks, where the first block has 3 elements, block 2 has 2 elements and block 3 has 4 elements.
So the first (main) array has 3 indexes: a[0], a[1] and a[2].
The subindexes for each mainindex are counted by the number of elements inside each block.
So, at mainindex 0 (a[0]), there are 3 subindexes, because there are 3 elements to be stored ([1,2,3]).
At mainindex 1 (a[1]), there are only 2 subindexes.
At mainindex 2 (a[2]), there are 4 subindexes.
After this declaration (first line of code), you have this setup:
a[0][0] = 1
a[0][1] = 2
a[0][2] = 3
a[1][0] = 4
a[1][1] = 5
a[2][0] = 6
a[2][1] = 7
a[2][2] = 8
a[2][3] = 9
Here you see clearly the each mainindex has different amounts of subindexes.
But can anyone explain why
Local a:Int[][] = [[1,2,3],[4,5],[6,7,8,9]]
works and
a:Int[][] = [[1,2,3],[4,5],[6,7,8,9]]
throws up the error: "Expecting expression but encountered '='"?