The second snippet looks as if it should be
dim world(10,10)
print Array Count (World())
which should give the answer 120 - which would becorrect as is the other answer of 3.
From the Help File:
Quote: "This is usually the value used to create the array when the DIM command was used, however by modifying the dynamic array this value can change throughout the execution of the program. When an array is completely empty, it will return a count of -1. The count refers to the number of available indexes, and so will return a count of zero when the command DIM arr(0) is used, representing the fact a single subscript is available at index zero."
which is a very convoluted way of saying that it is the index of the final element in the array. Arrays are stored as a single dimension list indexed from 0 to array count(). For example
gives an array of 12 elements indexed from 0 to 11 - so array count(a()) will return 11 which is the highest valued index.
Your first example has 4 elements indexed from 0 to 3. The double subscript that you used is just a convenient way for you to refer to those elements, i.e. the index pairs (0,0), (1,0), (0,1) and (1,1) refer to the elements (0), (1), (2) and (3).
Your second example, assuming my correction above, will have 121 elements indexed from 0 to 120 (i.e. 121 = (10+1)x(10+1) ) which can be indexed by the pairs (0,0), (1,0), and so on up to (10,10).
Try this snippet:
dim world(1,1)
print Array Count (World())
for i = 0 to 3
world(i)=i
next i
for i = 0 to 1
for j = 0 to 1
print j," ",i," ",world(j,i)
next j
next i
wait key
You can index the elements in a variety of ways as long as they are consistent with the number of elements in the array.