Traversing an array sequentially

Richard Gaskin ambassador at fourthworld.com
Wed Sep 24 16:09:16 EDT 2008


Mikey wrote:
> Does anybody else wish there was an easier way to traverse an array
> sequentially?

Many, it seems.  There was a long thread about this on the improve-rev 
list recently.

> Am I the only one who thinks that if the key specified is a numeral
> that it should be interpreted as the iterative position in the array?

You can treat it that way with just one line of code: the sort command.

   put the keys of tMyArrayA into tKeys
   sort lines of tKeys numeric
   repeat for each line tKey in tKeys
      -- do some sequential thing
   end repeat


Live the dream. :)

-- 
  Richard Gaskin
  Managing Editor, revJournal
  _______________________________________________________
  Rev tips, tutorials and more: http://www.revJournal.com



More information about the use-livecode mailing list