For the latest version of JMP Help, visit JMP.com/help.


Scripting Guide > JSL Building Blocks > Global and Local Variables > Show Symbols, Clear Symbols, and Delete Symbols
Publication date: 04/21/2023

Show Symbols, Clear Symbols, and Delete Symbols

The Show Symbols() function lists all variables and namespaces that are defined both globally and in the local JSL script, along with their current values. Here is an example of Show Symbols() messages that are shown in the log:

Show Symbols();

// Here

a = 5;

b = 6;

// 2 Here

// Global

c = 10;

// 1 Global

Tip: The JSL debugger also shows you the values of variables and namespaces. See Debug or Profile Scripts.

The Clear Symbols() function erases the values set for variables that are defined both globally and in the local JSL script. For example, after you clear and then show symbols, the variables are empty.

Clear Symbols();
Show Symbols();

// Here

a = Empty;

b = Empty;

// 2 Here

// Global

c = Empty;

// 1 Global

Note: The older Show Globals() and Clear Globals() functions are aliases of the newer Show Symbols() and Clear Symbols() functions.

To remove all global variables and namespaces, use the function Delete Symbols(). After the last Show Symbols() in the following script is run, nothing shows up in the log. All variables have been completely removed from memory.

Delete Symbols();
Show Symbols();

To list variables in all namespaces, use Show Namespaces(). To delete only a specific namespace, use ns << Delete. Clear Symbols() and Delete Symbols() do not clear or delete variables in each namespace, although they do clear and delete variables that contain references to namespaces. See Rules for Name Resolution for more information about unscoped variables.

Note: Clear Symbols() and Delete Symbols() break all scripts that are currently in use. These functions can be very useful in a programming and debugging environment, but do not include them in any script that you plan to distribute. If you include Names Default To Here(1) in your scripts, clearing and deleting global symbols is unnecessary.

Want more information? Have questions? Get answers in the JMP User Community (community.jmp.com).