694
Programming
À
Causes a
Circular definition
error message if x or i does not have a
value. The error does not occur if x or i has already been assigned a
value.
Controlling the flow of a function or program
When you run a program or evaluate a function, the program lines are
executed in sequential order. However, some commands alter the
program flow. For example:
•
Control structures such as
If...EndIf
commands use a conditional test
to decide which part of a program to execute.
•
Loop commands such as
For...EndFor
repeat a group of commands.
Using If, Lbl, and Goto to control program flow
The
If
command and several
If...EndIf
structures let you execute a
statement or block of statements conditionally, that is, based on the
result of a test (such as x>5).
Lbl
(label) and
Goto
commands let you
branch, or jump, from one place to another in a function or program.
The
If
command and several
If...EndIf
structures reside on the Program
Editor’s
Control
menu.
When you insert a structure such as
If...Then...EndIf
, a template is
inserted at the cursor location. The cursor is positioned so that you can
enter a conditional test.
If command
To execute a single command when 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 x before executing the
If
command.
For i,i,10,1
Disp i
À
EndFor
If x>5
Disp "x is greater than 5"
À
Disp x
Á
Summary of Contents for TI-Nspire
Page 38: ...26 Setting up the TI Nspire Navigator Teacher Software ...
Page 46: ...34 Getting started with the TI Nspire Navigator Teacher Software ...
Page 84: ...72 Using the Content Workspace ...
Page 180: ...168 Capturing Screens ...
Page 256: ...244 Embedding documents in web pages ...
Page 336: ...324 Polling students ...
Page 374: ...362 Using the Review Workspace ...
Page 436: ...424 Calculator ...
Page 450: ...438 Using Variables ...
Page 602: ...590 Using Lists Spreadsheet ...
Page 676: ...664 Using Notes You can also change the sample size and restart the sampling ...
Page 684: ...672 Libraries ...
Page 714: ...702 Programming ...
Page 828: ...816 Data Collection and Analysis ...
Page 846: ...834 Regulatory Information ...
Page 848: ...836 ...