EasyManua.ls Logo

HP HP-28S - Asking for a Choice

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...
The
displayed
menu
shows
the
labels
[:::I!:::]
,
[=:I::=:J,
and
:::::::::r::::::::I,
which
resemble labels in
the
Solver
menu.
After
entering
a value
on
the
stack,
the
user
can
simply
press
one
of
these
keys to store
the
value
in
the
corresponding
variable. After
entering
the
values,
the
user
must
press
.1
caNT
I to
continue
program
execution.
Asking for a Choice
For complex tasks it's
best
to write a series
of
small
programs,
each
performing
a
small
task.
In
some
cases
the
user
has
several
options
for
performing
one
of
the
tasks.
One
approach
is to write
alternative
programs
to
perform
that
task.
Assume
that
one
task is
completed,
and
the
user
must
choose
among
the
programs
HOP, SKIP,
and
JUMP for
the
next task.
The
following
sequence
creates a
custom
user
menu
for
programs
HOP, SKIP,
and
JUMP,
sounds
a
tone
to
alert
the
user,
and
ends
program
execution .
...
{ HOP SK I P
,..IUt'1P
}
MEtW
440
,1
BEEP
~:.
The
displayed
menu
shows
the
labels HOP , SK I P
,and
JUMP
,
which
resemble labels
in
the
User
menu.
When
the
user
presses
one
of
the
menu
keys,
the
next
task
is
performed.
That
task
may
end
with
a similar sequence, offering
the
user
a
different
set
of
options;
and
so
on
throughout
the
entire
complex task.
A
More
Complicated
Example
The
example
below
displays
a message, waits
until
the
user
presses a
key,
and
checks
that
the
key
is
defined
(that
is,
represents
one
of
the
choices).
If
the
key
is defined,
the
corresponding
action
is
performed;
if
the
key
isn't
defined,
an
error
message is
displayed
and
the
process
starts over.
This example uses
program
structures described in
the
previous
chap-
ter. There is
an
"outer"
DO
...
UNTIL
...
END
structure
that
repeats
until
the
user
presses a
defined
key.
The
outer
DO
clause contains
an
"inner"
DO
...
UNTIL
...
END
structure
that
repeats
until
the
user
presses a key.
The
outer
UNTIL clause contains a
conditional
that
27:
Interactive
Programs
235

Table of Contents

Other manuals for HP HP-28S

Related product manuals