Well I never!

Robert Brenstein rjb at robelko.com
Fri Mar 27 14:02:55 EDT 2009


On 26.03.09 at 23:47 -0700 James Hurley apparently wrote:
>Watching the web demo today I witnessed a funny thing. It looked like this
>
>twoDimenArray ["stuff"] ["moreStuff"]
>
>I said to myself, So THIS must be the two dimensional arrays I've heard about.
>
>Now silly me, I've been using
>
>oneDimenArray[i,j]
>
>Which I suppose now must be one dimensional arrays where the keys 
>are lists of two parameters. (But it sure looks like the two 
>dimensional arrays I held near and dear to my heart, low these many 
>years.)
>

Jim,

A short answer can be:

think of multi-dimensional array in Rev as an array of arrays.

A long answer is, well, longer and covers some of the obvious:

An array variable in Rev is a container storing a list of values 
which are indexed for retrieval. It is implemented as an associative 
array.

http://en.wikipedia.org/wiki/Associative_array

Since the keys of such an array can be anything, you can use two 
variables or literals with a comma in-between as index elements. This 
makes such an array appear like multi-dimensional arrays of Pascal, 
C, Fortran, etc., although technically, you still have 
one-dimensional array (each key is effectively a single string, a 
concatenation of your variables and comma).

Until now, this was the only way to get multi-dimensionality of your data.

Multi-dimensional arrays go way beyond that, making the index for 
each dimension independent, which Trevor so nicely explained and 
showed some of the new things possible.

Robert



More information about the use-livecode mailing list