Defining Variables

You can define your own variables. In general, the syntax for defining a variable is:
myvariable = expression
Variable names are not case sensitive. That means, for example, that the variable 'width' is the same as 'Width' or 'WIDTH'.

You can see which variables are currently in memory in the Memorylist. If the Memorylist isn't visible, then select Memorylist in the menu View or press <F9> to make it visible.

You can delete a defined variable by selecting the variable in the Memorylist and pressing <DEL>, or by typing the command Clear(myvariable) in the workarea. See System functions for more information about Clear.


'Examples of using variables

'First define some variables
Width = 4.5
       Width = 4.5

Height = 10
       Height = 10

' Now use the defined variables
Width * Height
       Ans = 45

' To hide the answer of a sum or definition, 
' you can end the line with a semicolon.
A = 3.5;
B2 = 2.25;
B3 = 3.5 - 1.5;

A * (B2 + B3)
       Ans = 14.875

'Delete a variable

'Test if the variable doesn't exist anymore
Width * 2
       Error: Unknown variable Width
Back to top

See Also

Memorylist, Defining Functions, System functions