EasyManua.ls Logo

HP HP-28S - Page 261

HP HP-28S
341 pages
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
To
maintain
execution if
an
error occurs,
the
R
~
B
command
is
placed inside
an
IFERR clause. Because
no
action is required
when
an
error occurs,
the
THEN clause contains
no
commands.
Enabling LAST.
In
case
an
error occurs, LAST
must
be
enabled
to
return
the
argument
to
the
stack. BDISP sets flag
31
to
pro-
grammatically
enable
the
LAST recovery feature.
FOR
...
NEXT
loop
(definite
loop
with
counter). BDISP executes a
loop from 1 to 4,
each
time displaying n in a
different
base
on
a
different
line.
The
loop
counter
(named
j
in
this program) is a local variable. It's
created
by
the
FOR
...
NEXT
program
structure (rather
than
by
a
~
command)
and
it's automatically
incremented
by
NEXT.
Subprograms. BDISP
demonstrates
three
uses for subprograms.
1.
BDISP
contains
a
main
subprogram
and
a call to PRESERVE.
The
main
subprogram
goes
on
the
stack
and
is evaluated
by
PRESERVE.
2.
When
BDISP creates a local variable for
n,
the
defining
pro-
gram
is a
subprogram.
3.
There are four
subprograms
that
"customize"
the
action
of
the
loop. Each
subprogram
contains a
command
to
change
the
bi-
nary
base,
and
each
iteration
of
the
loop
executes
one
of
these
subprograms.
Required Programs:
PAD (page 257)
expands
a string to
23
characters so
that
DISP
shows
it right-justified.
PRESERVE (page 258) stores
the
current
status, executes
the
main
subprograms
and
restores
the
status.
260
28:
Programming
Examples

Table of Contents

Other manuals for HP HP-28S

Related product manuals