Tutorial 3: Storing & Deleting
Storing and deleting user variables, strings, lists, matrices, etc...
HOME >> Tutorials >> Tutorial 3: Storing & Deleting

Introduction:
In this tutorial, we will learn how to store and delete different variables including user variables, strings, etc. After I give you the new commands, I will explain what each variable is.

New Commands:

STORE (Store) Stores a value into a variable
DelVar Deletes from memory the contents of variable
L Used to create new lists
dim Displays the dimension of the list or matrix

valueSTOREvariable dim(listname)
DelVar variable dim(matrixname)
LListname lengthSTORE(listname)
{rows,columns}STOREdim(matrixname)

New Variables:

User Variable An alpha character in which you can store a number into
String A type of variable in which you can store text
List A type of variable in which you can store a series of numbers
Matrix A two-dimensional array

Due to questions that I have received from people who have used this tutorial, I feel that I should further explain something. To enter in a matrix you press the MATRX button and choose from the different matrices that are listed. This is explained in the further definition of Matrix, but it seems that it was a problem. You cannot enter a matrix by separately entering the three pieces. You cannot enter "[A]", by pressing "[", "A", and then "]" separately; you must go to the matrix menu.

The Code:

: For AShell, SOS, and TI-Explorer
ClrHome Clears the home screen
DelVar B:DelVar Str3 Deletes the contents of user variable B and Str3
DelVar L2:DelVar [D] Deletes the contents of L2 and [D]
7STOREB Stores 7 into user variable B
"HI THERE"STOREStr3 Stores "HI THERE" into Str3
3STOREdim(L2) Stores 3 as the length of L2
4STOREdim(LTEST) Stores 4 as the length of LTEST
{2,3}STOREdim([D]) Stores 2x3 as the dimensions of matrix [D]
{2,1,9}STOREL2 Stores number sequence 2,1,9 into L2
{2,0,0,0}STORELTEST Stores number sequence 2,0,0,0 into LTEST
[[1,2,3][4,5,6]]STORE[D] Stores two-dimensional array into matrix [D]
Disp B,L2,[D] Displays the value of user variable B, L2, and matrix [D]
Output(7,1,LTEST) Displays LTEST starting at row 7 and column 1
Output(7,7,Str3) Displays Str3 starting at row 7 and column 7

Version 2.5 Update:
DelVar is generally not used at the beginning of the programs, but usually at the end. It is used at the end of programs to save ram space. If you delete the contents of a user variable, such as A, it gives you 15 more bytes of free memory. So each time that you delete the contents of a user variable, you add 15 bytes of free memory, which is very vital. Free memory helps your programs run faster and allows you to have more programs. I want to give a special thanks to John Myers, who emailed me giving me this information.

Conclusion:
First of all, notice that Str3 ("HI THERE") overlaps on LTEST {2,0,0,0}. I did this on purpose to show you another example of how Output( overwrites. Also, when you store 4 as the length of LTEST it creates LTEST. If we were to put a :Disp LTEST right after we store 4 as the length of LTEST and ended the program, the output would be {0,0,0,0}. In this tutorial, I also tried to implement everything that we have gone over so far. Storing is a major part of good programming especially, for games. Next, we are going to go on to Conditionals, which are also a major part of good programming.

If you do not understand a particular part in this lesson, have suggestions, or find any problems please contact me.

Previous Tutorial Next Tutorial
Tutorial 2 Tutorial 4





Problems with this page?
Contact the Webmaster.