Error getting tags :
error 404Error getting tags :
error 404 delete variable | revDocs | RunRev
Welcome Guest (Log in)
Product Edition
delete variable
Expander triangle
delete {local | global | variable} {variableName | arrayIndex}
Desktop, Web and Server
Platform Support
MacOS,Mac OS X,Windows,Linux
None required
Removes a variable from memory.

delete local tempVariable
delete global myArray[17] -- removes 17th element of that array

Additional Comments
Expander triangle

Use the delete variable command to free memory used by a large variable, or to clean up after using many variable names.


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.


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.

User Comments
Expander triangle
User thumbnail
Hans Behrens
Sep 8, 2009
When deleting variables, the variable MUST have been previously referenced in the script prior to being deleted. For example, if you have declared a global variable elsewhere in your stack, you may not delete it without creating a reference to it first inside the handler which deletes it.
This code will not work:

delete global gGlobalVariable

This code will work:

global gGlobalVariable

delete global gGlobalVariable