EasyManua.ls Logo

HP HP-28S - Page 226

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...
Flags. The
numbers
1
and
0
that
are
returned
by
test
commands
are
called
stack
flags.
Because
they
represent
the
truth
or
falsity
of
the
test, 1 is called a
true
flag,
and
0 is called a
false
flag.
The
term
Uflag"
also refers to
the
built-in
user
flags.
They are
num-
bered
1
through
64; flags
31
through
64
have
specific
meanings
to
the
calculator, while flags 1
through
30 can represent
any
true/false
dis-
tinction you wish.
You
can effectively store a stack flag
in
a
user
flag,
since
both
represent a
truth
value. For example,
the
sequence
IF
A B <
THEN
12
SF
ELSE
12
CF
END
sets flag 12 if A <
B,
or
it clears flag 12 if A
~
B.
You
can
later test
whether
flag 12 is set
by
the
sequence
IF
12
FS?
THEN
which
returns
the
same
truth
value as
the
original test A B
<.
The
advantage to this technique is
that
the
truth
value
of
the
original test
is preserved, even if
the
values
of
A
and
B
have
changed. The com-
mands
for changing
and
testing
user
flags
appear
in
uPROGRAM
TEST" in
the
Reference Manual. For
the
remainder
of
this chapter,
Uflag"
refers to a stack flag.
Clauses. The objects
and
commands
between
two program-structure
commands
are called a
clause.
Each clause is
handled
as a single
en-
tity
by
the
program
structure. A clause is labeled
by
its logical role
or
by
the
command
that
precedes it.
In
the
first example:
The clause
between
IF
and
THEN (X 0
;t:)
is called
the
test
clause
or
IF
clause.
The
clause
between
THEN
and
ELSE
(X
SIN X
/)
is called
the
true
clause
or
THEN
clause.
The clause
between
ELSE
and
END (1) is called
the
false
clause
or
ELSE
clause.
26:
Program
Structures
225

Table of Contents

Other manuals for HP HP-28S

Related product manuals