Delete an Array Entry?

Andre Garzia soapdog at mac.com
Thu Mar 1 09:31:18 EST 2007


Dave,

arrays are tricky. To delete array variables I use

delete variable myArray[myKey]

Andre

On Mar 1, 2007, at 11:10 AM, Dave wrote:

> Hi,
>
> Please see text from the RunRev 2.8.x Dictionary copied below. Is  
> the line:
>
>  delete global myArray[17] -- removes 17th element of that array
>
> Correct? Does it remove the 17th element, rather the element with  
> the Key that is "17" ?
>
> Thanks a lot
> All the Best
> Dave
>
>
> delete local tempVariable
> delete global myArray[17] -- removes 17th element of that array
>
> Description:
> Use the delete variable command to free memory used by a large  
> variable, or to clean up after using many variable names.
>
> Parameters:
> The variableName is the name of any local or global variable.
>
> The arrayIndex is a key of an array variable. If an arrayIndex is  
> specified instead of a variable name, the delete variable command  
> removes that element of the array, without deleting the rest of the  
> elements in the array.
>
> Comments:
> If you use the delete variable form, the variableName, global or  
> local, is deleted.
>
> The delete variable command not only removes the contents of the  
> variable, but deletes it entirely from memory. If you delete a key  
> from an array variable, that element of the array no longer exists  
> as part of the variable.
>
>   Note:  Local variables that are used within a handler are  
> automatically deleted when the handler in which they are used exits.
>
>
> _______________________________________________
> use-revolution mailing list
> use-revolution at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your  
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-revolution




More information about the use-livecode mailing list