Board Thread:Questions and Answers/@comment-24454571-20140517053531/@comment-24454571-20140520204135

SquareFingers wrote:

Actually, no. The computer doesn't HAVE to get to the end. Otherwise... the crane hovers in the middle of the program code, when you're finished. And that does no harm. There's no requirement for every DATA to be the subject of a READ, you don't have to get to the end. I did know that, actually, based on your guys description of how the DATA Pointer worked, but- oh my Gosh, I just realized I derped again... I get it now; all I had to do to read an extra line was to increase the size of the FOR loop. This is like one derp after another- I should really be putting more thought into this.

SquareFingers, you've been a really big help; do you think that you could help me create a very simple example of how to store DATA into an Array, and then print the Array?

I read Snailface's description, which seems greatly confusing:

"Declares an array (a group of data with a common name). Arrays in SmileBasic can be one or two dimensions and can be strings or numbers but not mixed. The parameters of the array are the max number of elements but you cannot use the max number. For example, in DIM array(10) you cannot assign array(10)=42. It can only be array(0-9). "

I don't understand the destinction there, of how Array of 10 can't = 42. That's weird.

Then his example is:

EXAMPLE: DIM ARRAY(2,2)

DATA 3,4,2,5

READ  ARRAY(0,0) , ARRAY(0,1) , ARRAY(1,0) , ARRAY(1,1)

PRINT ARRAY(0,0) , ARRAY(0,1) , ARRAY(1,0) , ARRAY(1,1)

OUTPUT: 3  4  2  5 So, what I'm not understanding most about here is how the computer is relating the Array with the DATA, and I especially don't get how that DATA line is read as a 2-Dimensional Array.