access the keys of an array..

Jeanne A. E. DeVoto jeanne at runrev.com
Fri Dec 14 01:19:01 EST 2001


At 6:45 AM -0800 12/13/2001, Niklas "Almesj–" wrote:
>Got the associative arrays working like a charm..
>One question though: Is there any way to access the
>keys of an array. I would like to do a repeat loop
>that loops through an array and use the keys..

Use (amazingly enough ;-) the keys function:

  get the keys of myArrayVariable

However, if you want to iterate through the elements of an array (rather
than using their keys), it's more efficient to use "repeat for each
element":

  repeat for each element myElement in myArrayVariable
    put myElement & return after field "Elements"
    -- or whatever action
  end repeat

--
Jeanne A. E. DeVoto ~ jeanne at runrev.com
http://www.runrev.com/
Runtime Revolution Limited - Power to the Developer!





More information about the Use-livecode mailing list