Using If, Lbl, And Goto To Control Program Flow - Texas Instruments TI-89 Manual Book

Ti ti-89: user guide
Hide thumbs Also See for TI-89:
Table of Contents

Advertisement

Using If, Lbl, and Goto to Control Program Flow

„ Control Toolbar
Menu
If Command
Tip: Use indentation to
make your programs easier
to read and understand.
If...Then...EndIf
Structures
Note: EndIf marks the end
of the Then block that is
executed if the condition is
true.
An If...EndIf structure uses a conditional test to decide
whether or not to execute one or more commands. Lbl (label)
and Goto commands can also be used to branch (or jump)
from one place to another in a program.
To enter
structures, use
If...EndIf
the Program Editor's „
toolbar menu.
The
If
command is available
directly from the „ menu.
To see a submenu that lists other
structures, select
If
2:If...Then
When you select a structure such as
, a template is
If...Then...EndIf
inserted at the cursor location.
To execute only one command if a conditional test is true, use the
general form:
Executed only if x>5;
otherwise, skipped.
Always displays the value of x.
In this example, you must store a value to
command.
If
To execute multiple commands if a conditional test is true, use the
structure:
Executed only if x>5.
Displays value of:
2x if x>5.
x if x5.
Control
.
:If | Then
:EndIf
The cursor is positioned so
that you can enter a
conditional test.
:If x>5
:
Disp "x is greater than 5"
:Disp x
before executing the
x
:If x>5 Then
: Disp "x is greater than 5"
: 2ù x! x
:EndIf
:Disp x
Chapter 17: Programming
295

Hide quick links:

Advertisement

Table of Contents
loading

This manual is also suitable for:

Ti-92 plusTi-92 plus

Table of Contents