Back to the PRGM menu, the second column, which you can reach by pressing the right arrow once, is the EDIT menu. This menu displays all programs in the memory of your TI that are written in TI-Basic and not marked hidden. By choosing the program you want to edit and pressing ENTER, you can see the source code of that program and edit it.
The final menu, which is the NEW menu, has only one choice which is “Create New”. Choosing this, you will be asked to give a name to your program. The name can have a minimum of 1 and a maximum of 8 letters some, but not all, of which can be numbers. The first character has to be a letter and the only usable characters except letters are numbers.
After entering the name and pressing ENTER you will be taken to the TI-Basic Editor, the program you will be using to create your programs. The first program I will help you to write will be the simplest program which is the classical first program written by all programmers, regardless of the programming language they use. The program is called “Hello World!”. All it does is to clear the screen and then display the message “Hello World!”.
First, follow the steps told above to create your program and give it any name you want. Now you must have a screen like this (where the name you have given the program will be displayed instead of HELLO):
To write commands in TI-Basic, you do not type them as you would do with computers. Instead you press the PRGM button where you will see another menu of three columns and the first two columns CTL and I/O has most of the commands you need. The first thing we want our program to do is to clear the screen, the command for which is ClrHome, the 8th command in the I/O column which you reach by pressing PRGM and then the right arrow. You will be taken to the Editor screen after you choose the command and press ENTER and now the screen will look like this:
Now press Enter once to go down to the next line. After each single command you have to go to the next line before writing another command. As another alternative, you may put a colon after a command and write a new command after the colon but in case of longer program codes this method usually complicates the matters for me.
The other thing our program must do is to display the text “HELLO WORLD!”. The text is all in capital letters since the TI-Basic does not have the option to use small letters unless you use MirageOS to change that fact. The command we need to use in order to accomplish that is the command Disp. You can find this command in the I/O column as the third command. Choose it and then press ENTER.
The Disp is different from the ClrHome command in the sense that it has to have an argument following it which must be the text to be displayed written between quotation marks (“). You can put a quotation mark by first pressing ALPHA and then + and to write the text hello world you must press ALPHA and then the button above of which the letter you want to be displayed is written in green. You can also press 2ND and then ALPHA to turn the Alpha Lock on and then you won’t have to press ALPHA after writing each letter. Don’t forget to put one quotation mark at the beginning of the text and another one at the end. After this your program must look like this:
Your first program is complete and ready to be executed! To run it you must first exit the Editor, you can do this by pressing 2ND and then MODE. Then press the PRGM button and in the first column (EXEC) choose the program and press ENTER. This will put the necessary command (which will be something like prgmPROGRAM_NAME) on the screen and then pressing ENTER will run the program. The screen will be cleared and the text HELLO WORLD will be displayed. Congratulations! You have written your first program in TI-Basic!
Commands Learnt:
ClrHome (8th command in the I/O column): Clears the home screen. It must be noted that this command does not clear the graph screen.
Disp “TEXT TO BE DISPLAYED” (3rd command in the I/O column): Displays the text written between the quotation marks on the home screen. It must be noted that this command cannot be used to write on the graph screen and it uses capital letters. In one line you can write 16 letters and the screen has 8 lines.
Creating Real Number Variables and Assigning Values to Them:
TI-Basic uses several types of variables. A variable is a pre-defined place where you can store values to be recalled or changed later. Most important type of these variables is the Real variables which are used to store real numbers. There are 26 such variables in maximum. To assign a value to a variable you do the following (you do not need to define the variable type like you do in other programming languages, the variables in TI are already defined):
Let’s say that you want to store the number 12.54 into the real variable A.You first write the value to be assigned to the variable, 12.54 in this example, and then press the STO key (first key on the second row from the bottom) to put the arrow that gives the calculator the command to assign the value. After putting the arrow you write the variable into which the value will be stored, A in this example, and you must have a command that looks like this:
12.54 → A
Then you can press ENTER and the variable A will have the value 12.54 stored in it until you change the value or delete the variable. You can assign a value to a variable in the home screen and in a program.