beautypg.com

Flags – HP 15c User Manual

Page 92

background image

92

Section 8: Program Branching and Controls

Following a conditional test, program execution follows the "Do if True"
Rule: it proceeds sequentially if the condition is true, and it skips one
instruction if the condition is false.
A t instruction is often placed right
after a conditional test, making it a conditional branch; that is, the t
branch is executed only if the test condition is met.

Flags

Another conditional test for programming is a flag test. A flag is a status
indicator that is either set (= true) or clear (= false). Again, execution
follows the "Do if True" Rule: it proceeds sequentially if the flag is set, and
skips one line if the flag is clear.

The HP-15C has eight user flags, numbered 0 to 7, and two system flags,
numbered 8 (Complex mode) and 9 (overflow condition). The system flags
are discussed later in this section. All flags can be set, cleared, and tested as
follows:

| F n will set flag number n (0 to 9).

| " n will clear flag number n.

| ? n will check if flag n is set.

A flag n that has been set remains set until it is cleared either by a "
n instruction or by clearing (resetting) Continuous Memory.