Using If, Lbl, and Goto to control program flow
The
command and several
If
statement or block of statements conditionally, that is, based on the
result of a test (such as x>5).
branch, or jump, from one place to another in a function or program.
The
command and several
If
Editor's
Control
When you insesrt a structure such as
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:
If x>5
Disp "x is greater than 5"
Á
Disp x
À
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
command.
If
If...Then...EndIf structures
To execute one group of commands if a conditional test is true, use the
structure:
If x>5 Then
Disp "x is greater than 5"
À
2
x
x
†
&
EndIf
Á
Disp x
À
Executed only if x>5.
Á
Displays the value of:
2x if x>5
x if x{5
Programming
If...EndIf
Lbl
If...EndIf
menu.
structures let you execute a
(label) and
Goto
structures reside on the Program
If...Then...EndIf
À
À
commands let you
, a template is
335