Branch commands – HP 38g Graphing Calculator User Manual
Page 163
Attention! The text in this document has been recognized automatically. To view the original document, you can use the "Original mode".
![background image](/manuals/632106/163/background.png)
Branch Commands
A programming structure allows a program to control how it
should execute depending on given conditions or the values
of particular arguments. The HP 38G has two kinds of
control
structures:
e Branch structures.
* Loop structures.
Branch structures
let a program make a decision based on the
result of one or more tests. Here is a summary of the branch
structures available on the HP 38G. (Unlike the other
programming commands, the control structure commands
work in logical groups. Therefore, the commands are
described together rather than each independently.)
IF...THEN... Executes a sequence of commands in the
test
only if the
ELSE...END
test-clause
evaluates to true. Its syntax is:
IF
te s t-c la u s e
THEN
tr u e -c la u s e
ELSE
fa ls e -c la u s e
END
IF...THEN...ELSE...END executes the
true
sequence of
commands if the
test
is true, or the
false
sequence
of commands if the
tesKlause
is false.
Exanqple
l^A :
IF A==l
THEN MSGBOX A " EQUALS 1" ;
ELSE MSGBOX A " IS NOT EQUAL TO 1“ :
end
:
Programming 8-11