ABC of arrays

Mike Bonner bonnmike at gmail.com
Mon Apr 20 18:11:11 EDT 2015


Yep.  myArray[1] Can either have a value such as "cheese" OR it can hold
more boxes/parking spaces/whatever.  But there is no way to have myArray[1]
contain "cheese" AND more boxes.

so if your array has myArray[1][2][3] and you put "Cheddar" into myArray[1]
everything in myArray[1][2][3] goes away.  So its either a  value, or more
boxes.

You can see this in action with a simple script like this:
put 1 into myArray[1][2][3]
put the keys of myArray[1] & " First key put" & cr -- puts key 2
put 1 into myArray[1]
put the keys of myArray[1]  & " Second key put" after msg -- puts no keys
because we wipe them out by putting a value in instead.

On Mon, Apr 20, 2015 at 2:49 PM, Colin Holgate <colinholgate at gmail.com>
wrote:

> I think your analogy isn’t right. A parking space in a car park can either
> hold a single vehicle or another car park, but not both a single vehicle
> and a car park. Or two vehicles come to that. If it does hold another car
> park, that would have its own parking spaces, for more vehicles, or car
> parks to occupy.
>
>
> > On Apr 20, 2015, at 4:38 PM, Bob Sneidar <bobsneidar at iotecdigital.com>
> wrote:
> >
> > >In this context I do not see how this statement that a box (element of
> an array) can contain another array or a value but not both. It’s kind of
> like saying a parking space can contain either a car or a rider on a
> bicycle, but not both.
>
> _______________________________________________
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode
>



More information about the use-livecode mailing list