Tutorial > Standard mode and common operations >


Using variables

CalcPad supports an unlimited number of memory storage holders called variables. Variables can have any name you like and importantly are not case sensitive. For clarity, short names are recommended but you can have longer names with individual words separated by the underline character.

Consider the calculation:
3 + x

In the above calculation x is a variable and when you perform the above calculation, since the value of x is unknown, the Enter task appears inviting you to enter a value for x; type for example the number 5 and press Select [Enter]; the result 8 is announced because the value of x is replaced by the number 5 and 3 + 5 results in 8.

Press Up to move to the previous calculation and perform it again. This time the Enter task does not appear; the reason for this is that the value is known to be 5 from the previous calculation so the result 8 appears immediately.

You can change the variable value by typing a simple assignment calculation as follows: x=7

The value of x is now 7 and if you perform the previous calculation again namely: 3 + x
Result 10

You can if you wish force the Enter task to appear each time you perform a calculation by typing the following assignment calculation:
x=?
The '?' character tells CalcPad to ask you each time the calculation is performed for a new value of x.

The special 'm' variable which represents the memory was mentioned before. Another special variable 'r' stores the latest result. You can use these variables to perform all the memory operations described previously as follows:

To assign the last result to memory:
m=r

To add the result to memory:
m=m+r
Or in short notation:
m+=r

To subtract the result from memory:
m=m-r
Or in short notation:
m-=r

You can use the memory variable in a calculation like any other variable so the calculation:
3 + m
will add the number 3 to the value stored in memory.

You can also use a calculation based on the previous result for example: 5 * r + 2 will multiply 5 times the previous result and add it to 2.

To find the value of a variable, simply type its name and press Select; for example:
x
Result: 10

You don't have to remember all the variables and their values. The Variables selector task in the Main menu
Calculator > Variables selector
enables you to examine and insert variables directly into your calculation.

As mentioned before, variable names are not case sensitive so the calculations:
n=3 (lower case n)
and
N=3 (N upper case)
are the same. In fact, before performing a calculation, variable names are converted to lower case so in the example above the value is stored in 'n' (lower case) so you get:
Result n=3

Important note on variable multiplication by a constant notation:

In algebra, if you have a variable called x and you want to multiply it by 5 for example, a common notation would be 5x. This notation does not work in SpeakOn. In fact if you type 5x in a calculation SpeakOn would interpret it is a variable name and generate an error informing you that a variable name cannot start with a number. In SpeakOn, 5x must be typed in a calculation as 5 * x

You can use the 'Clear all' command [Ctrl + Shift + Del] or [Ctrl + Shift + d] to clear all calculations, memory, variables and history.


[ Next - Using functions ]

[ Previous - Using memory ]

[ Up - Standard mode and common operations - Section ]

[ Up 2 - Tutorial - Section ]

[ Up 3 - SpeakOn CalcPad Manual and Tutorial - Main Index ]