TI-Basic
TI -Basic is the unofficial name of a programming language, with the programmable calculator from the U.S. company Texas Instruments (TI) work. It is slightly different from the used programming language BASIC. Are especially for the newer models of Texas Instruments, as the TI- 83 Plus or TI- 83 Plus SE, TI- 84 Plus, the TI-89, TI- 92 or TI- 92 Plus or Voyage 200 today a variety of programs.
- 2.1 variables
- 2.2 Repeat Loop
- 3.1 variables
- 3.2 menus, dialogs and toolbar 3.2.1 dialog
- 3.2.2 PopUp
- 3.2.3 Toolbar
General
Programs and Features
Both programs and functions can be created with TI- Basic. The difference is that functions in contrast to programs using the command return values can return, all other inputs and output commands ( Input, Output, PxlOn etc. ), however, are applicable only in programs. Furthermore, it is a function not possible to permanently store variables in the global namespace, but only temporarily and locally, as long as the function is executed.
Variables
Compared to many other programming languages, the number of possible variable names is very limited. It is only possible to use names that have eight letters or less ( the TI- BASIC dialect of the Ti -84 and Ti -83 even a letter) and not the same name as a system variable (for example, y1) have. Assigning a value to a variable occurs mostly on the operator " →". (Syntax: value → variable)
Programming
In addition to direct input on the TI programs can also be externally edited on a computer and then transferred to the TI via data cable.
Conditions ( all computers listed above )
- If statement:
: If condition: Disp " condition met ": Disp " This statement is executed in any case " If ... then ... EndIf statements:
: If condition Then: Disp " These instructions are ": Disp " all executed only ": Disp " if the condition is met ": EndIf: Disp " This statement is executed in any case " If ... Then ... EndIf else ... statements:
: If condition Then ( Multiple statements ): else ( Plurality of instructions that are executed only when the condition is not met): EndIf grind
All computers above
TI -Basic capable of the following types of loops: the for loop with count variable and the while loop is executed as long as condition is true. In addition, loops can be realized by means of labels.
TI Voyage 200
In the TI Voyage 200 and the Ti -89 is still loop and EndLoop an endless loop available. They can - such as while and EndWhile and research and EndFor - cancel the Exit command.
TI- 83 Plus; TI- 83 Plus SE; TI -84 Plus
Variables
In these machines, the following variables can be used:
Repeat Loop
Another loop type can only be used on these computers:
These instructions are on the newer computers also no longer available.
Newer computers (TI - 89 to Voyage 200 )
Variables
On newer computers variables can be up to eight characters long, it can also umlauts, Greek letters and diacritical marks ( unlike some other programming languages , such as Pascal ) can be used. " StorePic " and " StoreGDB " were replaced by " Stopic " and " StoGDB ".
Menus, dialogs and toolbar
Not only by the input and prompts InputStr, the user interface can be realized as follows:
- Dialogue with blocks
- With pop-up menus
- Using the toolbar (toolbar or Custom)
- With the getKey () function
Dialogue
An example of a dialogue:
: Dialog: Title " Hello ": Text "xyz": Drop "Please select ", { "one", "two ", "three "}, var1: Request " Your name? " Var2: EndDlog This example creates a dialog titled "Hello". In the actual window is the text " xyz ", including one between " one", "two " and "three " to select, and the bottom is an input field where the user is asked for his name.
Law is shown in screenshot where this sample program is shown.
PopUp
An example of a pop-up window:
: PopUp { "1999", "2001", "2002", "2005" }, var3 The result, so the selection is, " var3 " stored in the variable. When, for example, "2001" would be the content of var3 the number 2
Law is the screenshot of this program, only the Disp command has been added.
Toolbar
An example of a toolbar bar:
: Toolbar: Title " Quiz start ", start: Title " Options": Item " Settings", options: Item " About this Quiz " about, : Title " Exit", quit: EndTBar Should we ( here in this example) ( Start the quiz ) F1, select the program jumps to the specified label "start". If you want more, under a title list (as in F2 ), no label may be specified after the Title command. Under the Title command but items with labels must be present in such a case.
Law is also a screenshot of the toolbar. Only one output command has been replenished.
TI -Nspire and TI -Nspire CAS
In the first version of the operating system of the computer TI- Nspire and TI -Nspire CAS could be created with TI -Basic functions only, but no programs. Meanwhile, the full range of commands available. Programs can be stored in libraries.
Hello World
: ClrIO Deletes all characters on the display: Disp "HELLO WORLD " then displays "Hello World" or:
: ClrIO Deletes all characters on the display: Output 1,1, "HELLO WORLD " Displays the first line in the first column "Hello World" For TI -Nspire CX CAS:
: Disp "HELLO WORLD " Displays the "Home " window "Hello World" efficiency
Compared to the 68k assembler which is integrated with the calculator, TI- Basic programs are very slow. Particularly output commands slow down the execution, and due to the low RAM are recursions as the Ackermann function only partially or not at all, neither with TI -Basic or assembler.