TI-Basic 84 Programming/Basic Variables

What are Variables?
TI-Basic is unusual among programming languages in that it does not support actual variables. Instead, all data are treated like files; there is no distinction between an ordinary number and an image, for example. TI refers to all files as "variables;" henceforth "variable" will refer to a file usable by a program. "Variables" are the meat of any programming language - they are used to store and work with data. With variables, the outcomes of programs can differ depending on the user's input or the purpose of the program. Variables in the TI calculators can store different types of data, whether it be numbers, lists of numbers, strings, mathematical functions, etc. However, each data type has its own type of variable that it can be stored in and the rules must be followed fairly strictly.

Storing and Recalling Variables
Variables can be stored and recalled at the Homescreen (the startup screen), or within a program by simply using that variable's name. For example, to recall the variable X at the Homescreen, one would simply type X and hit enter (which would display 10 if X was ten):

or to recall Str1:

The format to recall any variable is the same.

To store a value to a variable, you simply state the value you are trying to store, hit the store key (the little arrow), then the variable you are storing to, and then hit enter. For example, making X equal to 52.5 would be as follows:

It should be noted that 52.5 was displayed after hitting enter on the homescreen. This is because it also recalled the value of the variable after storing it. In programming, the variable isn't actually recalled, but rather the variable is used in some sort of equation. See the individual examples for more help.

Types of Basic Variables
There are many types of variables, but in this chapter, only the most common ones will be dealt with. The Advanced Variables section, will deal with the more complex variable types and uses. The following sections will deal with:
 * Real Numbers (52.5, 100)
 * Lists (1,2,3,4,5)
 * Strings ("APPLES")

Real Numbers
For convenience in this section/chapter, it should be noted that the variables 'A' through 'Z' and the variable theta are considered to be Real Number Variables.

Real number variables store both an integer and decimal part of a number. Examples of real numbers are 0, 2.1, 5, 7.212 or 3.1415926. Reals are accurate up to eight significant digits and can be in the range of -9e99 to 9e99 (that is 9*10^99). If an attempt is tried to exceed this limit the calculator returns an error.

Syntax
To store a number to a Real Variable, the syntax is as follows:

Ex: Equation
* Note: In this example, if A was 89, X would be 42, not the actual equation. Only the result of an equation is stored to X (the equation is 5+36+89/89 = 42, so X is 42)

Lists
For convenience in this section/chapter, all lists will be considered as Real Number Lists.

Lists are basically what they sound like - lists of numbers. They are considered by some to be the same as an array. They store a series of numbers that are the same data type (for this section we will assume that it is a Real Number List). The individual numbers of a list are named elements.

Ex: Equations
*Note: In this example, L1 would consist of {20,25,35} because each element was increased by five then stored to L1