Dave wrote:
delete global myArray[17]

does not delete the 17th element, unless the key "17" just happens to the 17th element. The documentation is confusing on this point. Also the whole name "Array" for this datatype is confusing, a better name would be "table", since it doesn't behave like an array at all.

It behaves perfectly well as the associative array it is.

True, most programming languages focus on numerically indexed arrays, so unless you're familiar with associative arrays Rev's implementation can be confusing at first.

But the flexibility of associative arrays makes them well suited for a much broader range of tasks than numeric arrays, since the keys aren't limited to numbers but can be any string.

It might be helpful if Rev also supported numeric arrays, but in my own experience I've not found a true need for them that associative arrays couldn't handle.

And having one type of array that does it all means there's only one rule to remember: they key is a string.

If that string happens to be a number, you can use it pretty much like you would use a numeric array:

  repeat with i = 1 to 10
     put someData() into MyArray[i]
  end repeat

But being a string, you can also use non-numeric keys just as easily:

  repeat for each item tUser in "Dave,Ken,Richard"
    put SomeData() into MyArray[tUser]
  end repeat

--
 Richard Gaskin
 Managing Editor, revJournal
 _______________________________________________________
 Rev tips, tutorials and more: http://www.revJournal.com
_______________________________________________
use-revolution mailing list
use-revolution@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution

Reply via email to