Jump to content

TI-BASIC 83

From Wikipedia, the free encyclopedia
TI-BASIC 83
TI-BASIC Z80 code viewed on a TI-84 Plus CE
ParadigmProcedural
Typing disciplineStrong,Static(seeData types and variables)
PlatformTI-83 series,TI-84 Plus seriesprogrammable calculators

TI-BASIC 83,TI-BASIC Z80or simplyTI-BASIC,is the built-in programming language for theTexas Instrumentsprogrammable calculatorsin theTI-83 series.[1]Calculators that implement TI-BASIC have a built in editor for writing programs. While the considerably faster Z80assembly language[2]: 120 is supported for the calculators, TI-BASIC's in-calculator editor and more user friendly syntax make it easier to use. TI-BASIC is interpreted.[2]: 155 

Syntax

[edit]

The syntax for TI-BASIC 83 is significantly different compared to most dialects ofBASIC.For example, the language does not permit indentation withwhitespace characters.It also depends on theTI calculator character setbecause it istokenized.[2]: 25 Aside from these differences, TI-BASIC retains mostcontrol flowstatements: conditionals, various loops,GOTOsandLabels.Conditionals and loops useEndto denote the end of their bodies.

Each command can be placed on a new line, or separated by a colon for brevity. As such, the following snippets are identical in function.

:Disp "FOO
:Disp" BAR
and
:Disp "FOO:Disp" BAR

In the above example the closing double quotes can be omitted because the colon causes all open markers to be closed.

Unlike manyhigh-level programming languages,TI-BASIC has only one assignment operator:.The rightward arrow assigns the value on the left to the variable on the right.

Conditionals

[edit]

TI-BASIC includes simple constructs using theIfstatement. When theIftoken does not have aThentoken on the following line it will only execute the next single command.

:If condition
:command

Whereconditionis any boolean statement. One benefit of this format is brevity as it does not includeThenandEnd.AnIfstatement may have more than one command in its body if, instead of a command, aThentoken is placed.

:If condition
:Then
:command
:command
:End

When usingThen,the body must be closed by anEndtoken. One more construct utilizesElse.This allows one of two bodies to be executed.

:If condition
:Then
:body one
:Else
:body two
:End

In this case the calculator evaluatescondition,if it evaluates to truebody oneis executed, however, ifconditionevaluates to false,body twois executed. Unlike many other programming languages, TI-BASIC has noelse ifconstruct, or anyswitch statement.

[edit]

It does, however, have aMenu(statement which allows a user to select one of a number of options. Similar to a switch menus do have fallthrough. The general syntax isMenu(,a quoted title string, and followed by quoted option name and label name. An example:

:Menu( "TITLE", "FIRST",1, "SECOND",2, "THIRD",3)
:Lbl 1
:body one
:Lbl 2
:body two
:Lbl 3
:body three
TI-84 Plus CE Menu example

The image is how the calculator renders the example above.

In terms of functionality, theMenu('s flow is similar to some switch statement and cases, with a key difference that the user supplies the switch's usual expression. Like many switches and cases, theLblallows fall-through. For example, in the code above, if a user selects "FIRST", all three bodies are executed. However, selecting "SECOND" means only the second and third bodies are executed.

Loops

[edit]

TI-BASIC includes three types of loops:For(,While,andRepeat.

For(

[edit]

For(is similar to many other languages. It will repeat commands either a set number of times, or a variable number.

:For(variable,start,end[,increment])
:body
:End

While and Repeat

[edit]

Whiletakes a single argument, a condition which must be fulfilled, without parentheses.Repeatfunctions the same way except that it loops when the given condition is false.[3]

:While condition
:body
:End

DS<( and IS>(

[edit]

DS<(andIS>(are specialized conditionals that are similar in overall function toIfstatements. However, they have the unique property of changing the value of the given variable.

:DS<(variable,value)
:Command

Data types and variables

[edit]

TI-BASIC is strongly and mostly statically typed. Most variables, besides lists and programs, have predefined names and allowed types. Each variable can usually only hold one data type, the exceptions are the numeric and all list variables which can hold either real or complex values.

Numeric

[edit]

There are 27 numeric variables,AthroughZ,andθ.[2]: 28 These can hold two types of values, real and complex. All numbers are stored in theRAMasfloating-point numberswith 14-digit mantissa, orsignificand,and an exponent range of -128 to 127.Complex numbersare stored as two consecutive reals.

List

[edit]

Lists are also supported through the use of six built-in lists, and user created lists with up to five characters as the name. They are capable of holding up to 999 elements. A list may hold entirely real numbers or entirely imaginary numbers. Some functions in the calculator are able to operate over entire lists, viaArray programming.

Matrix

[edit]

Matrices are supported through the use of ten built-in matrices. Matrices do not support user created names or complex numbers.

Strings

[edit]

There are ten built-in strings for storing variable text, namedStr1throughStr0.

Other data types

[edit]

The TI-83 family supports several more data types other than numeric, list, and matrix types: token based data, screen image data, and graph database data. These data types cannot be directly manipulated by TI-BASIC.

References

[edit]
  1. ^"TI-84 Plus".education.ti.
  2. ^abcd"TI-83 Plus Developer Guide"(PDF).Texas Instruments.Retrieved15 April2019.
  3. ^"TI-83 Graphing Calculator Guidebook"(PDF).Texas Instruments. p. 16-11.Retrieved12 October2021.
[edit]