EasyManua.ls Logo

HP HP-28S User Manual

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
Page #228 background imageLoading...
Page #228 background image
IF
...
THEN
...
END
If
an
ELSE clause
isn't
required-that
is, if
the
choices are to
do
something
or
do
nothing-you
can
omit
ELSE from
the
program
structure.
The
following example
ensures
that
the
object in level 1 is
greater
than
the
object in level 2
by
swapping
them
if necessary.
IF
DUP2
,
THEN
SWAP
END
Note
the
use
of
DUP2
to
make
copies of
the
objects.
The
copies are
then
consumed
by
the
comparison
,.
For
another
example
of
IF
THEN
...
END, see "SORT (Sort a List)"
on
page
270.
1FT
(If-Then-End Command)
You
could
write
the
previous example
by
using
the
command
1FT
in-
stead
of
the
program
structure:
DUP2
, «
SWAP»
1FT
The
sequence
D U P 2
'leaves
a flag
on
the
stack,
the
program
.,=,:
::;;(.j
A P
:,=,.
goes
on
the
stack,
and
the
command
1FT takes
the
flag
and
the
program
as
arguments.
If
the
flag
is
true,
1FT
evaluates
the
program; if
the
flag is false,
1FT
drops
the
program.
The
result is
iden-
tical to
the
program-structure
form.
Error Traps
In
some
cases you
can
predict
that
an
error
might
occur
during
pro-
gram
execution.
Normally
an
error
cancels
program
execution;
but
if
you
trap
the
offending
command
by
enclosing it in a special
program
structure,
the
program
can
continue
execution
when
the
error
occurs.
Remember
the
problem
with
(sin
x)/x-it
causes
an
Infinite Result er-
ror
when
x =
O.
Another
method
for
defining
(sin
0)/0
= 1
would
be:
IFERR X SIN X /
THEN
DROP2
1
END
26:
Program
Structures
227

Table of Contents

Other manuals for HP HP-28S

Question and Answer IconNeed help?

Do you have a question about the HP HP-28S and is the answer not in the manual?

HP HP-28S Specifications

General IconGeneral
Introduced1988
Memory32 KB
Number of Digits12
TypeScientific Calculator
ManufacturerHewlett-Packard (HP)
DisplayLCD
ProcessorSaturn
ProgrammingRPL

Summary

HP-28S Advanced Scientific Calculator Owner's Manual

Part 1: Fundamentals

Introduces basic operations, calculator features, and core concepts.

Getting Started

Covers initial setup, basic operations, and calculator overview.

Doing Arithmetic

Explains methods for performing calculations using stack and expressions.

Part 2: Summary of Calculator Features

Objects

Describes fundamental data types, symbolic operations, and programming elements.

The Command Line

Explains input methods, cursor control, and command entry.

The Stack

Reviews stack concepts and commands for manipulating objects.

Part 3: Programming

Program Structures

Covers conditional logic, loops, and error handling in programs.

Conditional Structures

Explains testing conditions and making decisions within programs.

Definite Loop Structures

Details structures for executing code a specific number of times.

Appendixes & Indexes

Appendix A: Assistance, Batteries, and Service

Provides troubleshooting, battery info, and service details.

Answers to Common Questions

Addresses frequent user queries and common calculator issues.

Appendix B: Notes for HP RPN Calculator Users

Highlights differences for users familiar with RPN calculators.

Appendix D: Menu Map

Lists commands by menu, with descriptions and page references.

Contacting Hewlett-Packard

Related product manuals