Download  Print this page

Definite Loop Structures; Start - HP -28S Manual

Advanced scientific calculator.
Hide thumbs

Advertisement

This means: Evaluate the IFERR clause (:":
~;
Hl
::< /).
If an error oc-
curs, evaluate the THEN clause
(DF.:OP2
1).
This example includes the command DROP2 to drop the two zeros
that caused the error. Note that this assumes that LAST is enabled. If
LAST is disabled, the zeros aren't present and the DROP2 command
is inappropriate. Be sure to consider the state of LAST when using
error traps.
Another example of I
FEF.:F.: ... THEt'l ...
Et~D
appears in "BDISP (Bi-
nary Display)" on page 259. Also, you can include an ELSE clause to
be evaluated only if an error doesn't occur, using the form
I FEF.:F.: ...
THE~l
'"
EL~;E
... Et·W
Definite Loop Structures
Loop structures contain a
loop clause
that is repeatedly evaluated. In a
definite loop structure,
the program specifies in advance how many
times to evaluate the loop clause. Another type of program structure,
called an
indefinite loop structure,
uses a test clause to determine
whether to repeat evaluation of the loop clause. This section describes
definite loop structures; indefinite loop structures are described on
page 231.
START ... NEXT
The following example sounds a tone four times.
1 4 STAF.:T 440
,1 BEEP NEXT
This structure works as follows:
1. The command START takes the values 1 and 4 from the stack
and creates a
counter.
The counter will be used to keep track of
how many times to repeat the loop. The value 1 specifies the
initial value
of the counter, and the value 4 specifies its
final
value.
228
26: Program Structures
I

Advertisement

Table of Contents

   Also See for HP HP-28S

   Related Manuals for HP HP-28S

Comments to this Manuals

Symbols: 0
Latest comments: