Welcome to TI-BASIC 83

TI-BASIC 83 (also called TI-BASIC for short) is a built-in interpreted programming language for the TI-83 series calculators. These calculators also come with a built-in code editor for writing TI-BASIC programs. Besides the TI-84 Plus CE Python Edition, which also has a Python editor, TI-BASIC is the only language that users can program directly on these calculators.

Supported Calculators

The following eight calculators come with TI-BASIC 83:

What You Should Already Know

This guide assumes that you're familiar with the following:

The Program Menu and Creating New Programs

To create your first TI-BASIC program, you must first access the program menu by pressing the PRGM button. The program menu has three submenus: EXEC, EDIT, and NEW, which allow you to execute, edit, and create programs, respectively. Go to the NEW submenu and select Create New. Once you do so, you should see a prompt to enter a name for your new program. Program names must be less than or equal to 8 characters. Once you type a one, press ENTER to enter the code editor, where you can begin editing your newly created program.

Entering Commands and Statements

Unlike other languages, where you must type each command, TI-BASIC requires you to insert them from the program menu, which you can access by pressing PGRM. The program menu has three submenus: CTL, I/O, and EXEC. The CTL submenu contains control flow statements, the I/O submenu contains commands for taking input and giving output, and the EXEC submenu lists all of the programs on your calculator. Selecting a program from the EXEC submenu allows you to run it from within your program.

Each statement in TI-BASIC starts with a colon, and in most cases, you don't have to insert them manually. There are two ways to begin a new statement in TI-BASIC:

Here's an example of both ways to create new statements—don't worry about not understanding this program, the following sections will teach you more about the many commands TI-BASIC offers:

:Disp "STATEMENT 1" :Disp "STATEMENT 2":Disp "STATEMENT 3"

Hello World

Students learning a new programming language often begin by writing a program that prints "Hello, World!" to the screen.

In TI-BASIC, such a program looks like this:

:Disp "HELLO, WORLD!"

After you write this program, exit the code editor and run this program to see the output.

Data Types and Variables

TI-BASIC is a strongly-typed language, meaning that the variable's type must be part of its declaration. But unlike other strongly-typed languages, such as Java and C++, TI-BASIC doesn't have variable type keywords such as int and double, instead, the variable names themselves determine which data type they can store. TI-BASIC has four data types that you can directly modify within your programs: numbers, lists, matrices, and strings.

Table. TI-BASIC data types, descriptions, and designated variable names
Data Type Description Variable Names
Number Numbers can be either real or complex. Real numbers can store up to 14 digits, but the calculator only displays the first 10. These first ten digits are also the only ones used in comparisons. Complex numbers store 2 consecutive real numbers, representing the real and imaginary parts. AZ and θ
List Lists are sets of numbers enclosed in braces. On most calculators, they can store up to 999 elements, but on TI-83s, they have a maximum length of 99. Unlike other TI-BASIC data types, lists can have custom names. Custom list names must be less than or equal to 6 characters, and the first character must be the symbol—which you can enter by pressing 2ND + STAT + + ALPHA + APPS. L1L6 (You can access these symbols through the LIST menu), or custom name.
Matrix Matrices are two-dimensional lists with a maximum size of 99×99 (or 9801 elements). The entire matrix, as well as each row, is enclosed in brackets. Matrices use more memory than lists, and, unlike lists, they cannot store complex numbers. [A][J] (You can access these symbols through the MATRIX menu).
String Strings are sequences of characters enclosed in parentheses. Unlike the other data types, Strings can hold as many characters as the calculator's RAM allows. Str1Str0 (You can access these symbols through the STRING menu by pressing VARS + 7).

Assignment Statements

Assignment statements in TI-BASIC have a unique structure. Unlike most programming languages, assignment statements in TI-BASIC place the variable's name after its value. Also, whereas most languages use the equal sign as an assignment operator, TI-BASIC uses the symbol, which you can enter by pressing the STO› button.

Here are some examples of TI-BASIC assignment statements:

:42→N :{1,1,2}→L1 :[[1,1,2][3,5,8]]→[A] :"HELLO, WORLD!"→Str1

Comparison and Logical Operators

TI-BASIC has six comparison and four logical operators. You can access them through the TEST menu, which has two submenus, TEST and LOGIC. The submenus contain comparison and logical operators, respectively. The table below displays each operator, their name, and an example of each:

Table. TI-BASIC comparison and logical operators
Type Operator Name Example
Comparison = Equal to X=Y
Comparison Not equal X≠Y
Comparison > Greater than X>Y
Comparison Greater than or equal to X≥Y
Comparison < Less than X<Y
Comparison Less than or equal to X≤Y
Logical and Logical AND X and Y
Logical or Logical OR X or Y
Logical xor Exclusive OR X xor Y
Logical not( Logical NOT not(X and Y)

TI-BASIC doesn't have a designated boolean data type; instead, it uses numbers to represent truth values. All positive and negative numbers are considered true, and the number zero is false.

For example, the following code:

:Disp 1 and 1 :Disp 1 and 0 :Disp 42 and 43 :Disp 42 and 0

Gives the following output:

0 1 0 1

Conditionals

Conditionals are one of the ways to change the control flow of your programs. TI-BASIC has two types of conditionals, if-then(-else) constructs and the IS>( and DS<( commands. This section takes a look at each of them.

If-then constructs, also known as "if statements," are the simplest type of conditional, and almost every programming language has them. These conditionals run a specified series of statements if a given condition is true.

In TI-BASIC, if-then constructs have the following syntax:

:If condition :Then :…Code to run if true :End :…Rest of program

You can exclude the Then and End commands if your if-then construct only has one statement—unfortunately, this doesn't work with if-then-else constructs.

:If condition :…Single statement to execute if true :…Rest of program

Like most programming languages, TI-BASIC also has an Else command, allowing you to create if-then-else constructs—also known as if...else statements.

In TI-BASIC, If-then-else contructs have the following syntax:

:If condition :Then :…Code to run if true :Else :…Code to run if false :End :…Rest of program

The IS>( and DS<( commands take two arguments—neither of which can be complex numbers:

  1. A number variable (AZ or θ)
  2. A number, a number variable, or an expression

The IS>( command increments the variable by one and compares it to the second argument. If it's less than the second variable, then the following line of code runs—otherwise, it's skipped.

Here's an example of the IS>( command—this program should print "1 IS LESS THAN 2":

:0→N :IS>(N,2) :Disp "1 IS LESS THAN 2"

On the other hand, the DS<( command decrements the variable and checks if its value is greater than the second argument. If its greater than the second argument, then the following line of code runs.

Here's an example of the DS<( command—this program should print "1 IS MORE THAN 0":

:0→N :DS<(N,2) :Disp "1 IS MORE THAN 0"

For-Loops

For-loops execute a series of statements for a given number of times. For-loops in TI-BASIC use the For( command, which takes three or four arguments:

  1. A loop counter variable
  2. An initial value for the loop counter
  3. A maximum value of the loop counter
  4. (Optional) Step size (1, by default).

The loop counter variable starts at the initial value and increments by the step size at the beginning of each iteration. Once the loop counter reaches the maximum value, the loop ends.

Here's an example of a for-loop:

:For(I,1,5) :Disp I :End

The code above should give the following output:

1 2 3 4 5

While and Repeat-Loops

While-loops run a specified series of statements while a given condition is true. While-loops in TI-BASIC have the following syntax:

:While condition :…Code to run while true :End :…Rest of program

Repeat-loops are similar to while-loops, except they run until their condition becomes false. Repeat-loops have the following syntax:

:Repeat condition :…Code to run while false :End :…Rest of program

Variable Scope and Deleting Variables

All variables in TI-BASIC have global scope, meaning that they're accessible throughout the entire program. They also stay in memory even after the program ends. To prevent variables from taking too much memory, delete them using the DelVar command followed by the variable's name.

Here are some examples of the Delvar command:

:DelVar N :DelVar L1 :DelVar [A] :DelVar Str1

To save even more memory, you can condense the above code into a single statement

:DelVar NDelVar L1DelVar [A]DelVar Str1

References

  1. "TI-BASIC 83." Wikipedia. https://en.wikipedia.org/wiki/TI-BASIC_83. Accessed .
  2. "Why TI-BASIC." TI-Basic Developer. http://tibasicdev.wikidot.com/whytibasic. Accessed .
  3. "The Calculators." TI-Basic Developer. http://tibasicdev.wikidot.com/thecalcs. Accessed .
  4. "Your First Program." TI-Basic Developer. http://tibasicdev.wikidot.com/sk:first-program. Accessed .
  5. "Data Types." TI-Basic Developer. http://tibasicdev.wikidot.com/sk:data-types. Accessed .
  6. "Lists." TI-Basic Developer. http://tibasicdev.wikidot.com/sk:lists. Accessed .
  7. "Matrices and Their Commands." TI-Basic Developer. http://tibasicdev.wikidot.com/matrices. Accessed .
  8. "Pictures and GDBs." TI-Basic Developer. http://tibasicdev.wikidot.com/pictures. Accessed .
  9. "TI Codes: TI-84 Plus Technology." Texas Instruments. https://education.ti.com/en/activities/ti-codes/84/10-minutes. Accessed .
  10. "The Basics of Variables." TI-Basic Developer. http://tibasicdev.wikidot.com/sk:variables. Accessed .
  11. "Java Operators." W3Schools. https://www.w3schools.com/java/java_operators.asp. Accessed .
  12. "Conditional (computer programming)." Wikipedia. https://en.wikipedia.org/wiki/Conditional_(computer_programming). Accessed .
  13. "The IS>( Command." TI-Basic Developer. http://tibasicdev.wikidot.com/is. Accessed .
  14. "The DS<( Command." TI-Basic Developer. http://tibasicdev.wikidot.com/ds. Accessed .
  15. "Loops." TI-Basic Developer. http://tibasicdev.wikidot.com/sk:loops. Accessed .
  16. "For loop." Wikipedia. https://en.wikipedia.org/wiki/For_loop. Accessed .