[7.35] Conditonal Test In If; [7.36] Input Arguments For 'Keyboard' Programs; Conditonal Test In If ...Endif Evaluates All 'And' Arguments - Texas Instruments TI-89 Tip List

Graphing calculator
Hide thumbs Also See for TI-89:
Table of Contents

Advertisement

You can paste multiple line feed characters to insert blank lines between the comments.
This method fails if you open and save the program in GraphLink: the linefeed characters are removed.
There is no known way to insert the linefeed characters in GraphLink.
(Credit to Bhuvanesh Bhatt)

[7.35] Conditonal test in If ...EndIf evaluates all 'and' arguments

Combining some arguments with the Boolean and operator will cause a TI Basic program to fail. For
example:
If GetType(lista)="LIST" and lista[1]=2 then
3→lista[1]
EndIf
In this example a program error occurs if the variable lista is not actually a list. This problem is avoided
by using two nested If statements:
If GetType(lista)="LIST" then
If lista[1]=2 then
3→lista[1]
EndIf
Endif
{Behavior discovered by Kosh DV}

[7.36] Input arguments for 'keyboard' programs

The TI-89 / TI-92 Plus support up to nine 'keyboard' programs. These programs can be executed from
any folder by pressing [DIAMOND][1] for kbdprgm1(), [DIAMOND][2] for kbdprgm2(), and so on. Unlike
other programs, keyboard programs cannot have input arguments. However, keyboard programs can
use the ans() and entry() functions. ans(n) is a built-in function which returns answer n from the history
display, and entry(n) returns entry n. These functions can be used to provide input to keyboard
programs. As a simple example, suppose we want kbdprgm2() to convert a temperature to Kelvin
degrees. The program is
kbdprgm2()
Prgm
dialog
text string(tmpcnv(expr("ans(1)"),_°K))
enddlog
EndPrgm
Note that we cannot just use ans(1) as the tmpCnv() argument. If we did, the TI Basic tokenizer would
permanently replace ans(1), in the program, with the actual value of ans(1) at the time the program
ran. Using the expression expr("ans(1)") prevents this silly behavior.
To use the program, enter the temperature to convert, then press [DIAMOND][2], and a dialog box
shows the converted temperature. For example, to convert 32°F to K, press
32 [_] [°] [f] [ENTER]
7 - 35

Hide quick links:

Advertisement

Table of Contents
loading

This manual is also suitable for:

Ti-92+

Table of Contents