If...then...else... Endif Structures; Lbl And Goto Commands; If...then...elseif... Endif Structures - Texas Instruments TI-NSPIRE Software Manual

Cas computer software
Hide thumbs Also See for TI-NSPIRE:
Table of Contents

Advertisement

Note:
marks the end of the
EndIf
condition is true.

If...Then...Else... EndIf structures

To execute one group of commands if a conditional test is true and a
different group if the condition is false, use this structure:
If x>5 Then
Disp "x is greater than 5"
À
2
x
x
&
Else
Disp "x is less than or equal to 5"
Á
5
x
x
&
EndIf
Â
Disp x
À
Executed only if x>5.
Á
Executed only if x{5.
Â
Displays value of:
2x if x>5
5x if x{5

If...Then...ElseIf... EndIf structures

A more complex form of the If command lets you test for multiple
conditions. Suppose you want a program to test a user-supplied
argument that signifies one of four options.
To test for each option (If Choice=1, If Choice=2, and so on), use the
If...Then...ElseIf...EndIf

Lbl and Goto commands

You can also control the flow by using
These commands reside on the Program Editor's
Use the
command to label (assign a name to) a particular location in
Lbl
the function or program.
labelName
Lbl
336
structure.
name to assign to this location (use the same naming
convention as a variable name)
block that is executed if the
Then
À
(label) and
Lbl
Transfers
Á
commands.
Goto
menu.
Programming

Advertisement

Table of Contents
loading

This manual is also suitable for:

Ti-nspire

Table of Contents