Scripts - Workspace variables
The value of a workspace variable is not stored in the spreadsheet, but in a separate memory space.
A new workspace variable is created by assigning a value to a valid variable name.
A variable name must adhere to the following rules:
- it cannot be longer than 32 characters.
- it cannot contain a space or a character from the reserved character set:
- + / * = < > # & @ $ | ^ : , ; . ( ) ' " [ ] { }
- it cannot be equal to a spreadsheet cell address (such as A1 or DC12),
- it cannot be equal to a script command or language construct such as beep, print, etc., see List of script commands and language constructs.
- variable names are not case sensitive (for example VARX or varx refer to the same variable)
A value is assigned to a variable using the = operator.
The following script code creates a variable sum and assigns the value 11 to it:
sum=5+6;
Workspace variables are untyped and may contain numeric values, strings, complex numbers, matrices, or tables.
num=5; str="A string is placed in double quotes"; nstr='or single quotes'; cmplx=5+3i; mtrx={5,6,3|1,8,9};
Clear mem command
The Clear mem command deletes or clears all workspace variables.
- When this command is given in the beginning of a script, it deletes all workspace variables.
- When this command is given after a workspace variable has already been referenced in the script, it will only clear all workspace variables.