EasyManuals 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 #224 background imageLoading...
Page #224 background image
For example,
the
user
function
COT
(from
chapter
5)
was
written:
Here
the
local-variable structure stores
one
argument
in a local vari-
able
}::
(satisfying
the
first
requirement)
and
evaluates
the
expression
, I
t,fI..!
0::
TAt·l
0::
::<::0
::0
' (satisfying
the
second
requirement).
The
user
func-
tion
O-C
(from
chapter
14)
included
a
program
rather
than
an
expression but, since
the
program
returned
exactly
one
result,
O-C
also satisfied
the
second
requirement.
These
requirements
apply
only to
user
functions. More generally, local
variables are
used
as a
substitute
for stack
manipulations.
The
follow-
ing
example
returns
the
sum
and
difference
of
two
numbers.
Since it
returns
two results, it
can't
be
a
user
function.
«
~
x y « x y + x y - » »
For
more
examples, see
the
programs
in
chapter
28.
They
use
local-
variable
structures
more
often
to avoid stack
manipulations
than
to
create
user
functions.
Conditional
Structures
Conditional
structures
enable
a
program
to test a specified
condition
and
make
a decision
based
on
the
result
of
the
test. This section first
gives
an
example
of
a
conditional
structure.
It
uses
that
example to
discuss
program
structures
in general,
and
then
it describes
other
types
of
conditional
structures.
Suppose
you're
writing
a
program
that
uses
the
variable
x,
and
you
want
to calculate (sin x)jx. A
problem
arises
because
the
quotient
is
undefined
when
x =
O.
The
following example
returns
(sin
x)jx
if
x
=1=
0, or
returns
1 if x =
O.
IF
X 0
~
THEN
X SIN X /
ELSE
1
END
26:
Program
Structures
223

Table of Contents

Other manuals for HP HP-28S

Questions and Answers:

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
BrandHP
ModelHP-28S
CategoryCalculator
LanguageEnglish

Related product manuals