294 Chapter 17: Programming
17PROGRM.DOC TI-89/TI-92 Plus: Programming (English) Susan Gullord Revised: 02/23/01 1:14 PM Printed: 02/23/01 2:18 PM Page 294 of 40
¦ Type the operator directly from the keyboard.
— or —
¦
Press
2I
and select
8:Test
. Then select the
operator from the menu.
— or —
¦
Display the built-in functions.
Press:
TI
.
89:
½
TI
.
92 Plus:
2 ½
The test operators are listed
near the bottom of the
„
Built-in
menu.
Relational operators let you define a conditional test that compares
two values. The values can be numbers, expressions, lists, or
matrices (but they must match in type and dimension).
Operator True if: Example
>
Greater than
a>8
<
Less than
a<0
‚
Greater than or equal to
a+b
‚
100
Less than or equal to
a+6
b+1
=
Equal
list1=list2
ƒ
Not equal to
mat1
ƒ
mat2
Boolean operators let you combine the results of two separate tests.
Operator True if: Example
and
Both tests are true
a>0 and a
10
or
At least one test is true
a
0 or b+c>10
xor
One test is true and the
other is false
a+6<b+1 xor c<d
The
not
function changes the result of a test from true to false and
vice versa. For example:
not x>2
is true if
x
2
false if
x>2
Note:
If you use
not
from the Home screen, it is shown as
~
in the
history area. For example,
not x>2
is shown as
~(x>2)
.
Conditional Tests
Conditional tests let programs make decisions. For example,
depending on whether a test is true or false, a program can
decide which of two actions to perform. Conditional tests are
used with control structures such as
If...EndIf
and loops such
as
While...EndWhile
(described later in this chapter).
Entering a Test
Operator
Relational Tests
Tip: From the keyboard,
y
ou can type:
>= for
‚
<= for
/
= for
ƒ
(To get the / character,
press
e
.)
Boolean Tests
The Not Function