Download  Print this page

Ifte (if-then-else-end Function) - HP -28S Manual

Advanced scientific calculator.
Hide thumbs


The clauses in the example represent simple numerical calculations,
but you can include any sequence of objects and commands. In effect,
a clause is like a subprogram within the program. If you write a sepa-
rate program that contains the clause and store this program in a
variable, you can use the variable's name as the entire clause. In this
case a simple-looking structure like
can represent a complicated decision process with two possible com-
plicated results, depending on the contents of A, B, and C.
IF ... THEN ... ELSE ... END
Using the terminology just defined, the evaluation of this conditional
structure can be described as follows: The IF clause is evaluated and
returns a flag. If the flag is true, the THEN clause is evaluated; if the
flag is false, the ELSE clause is evaluated.
For another example of this structure, see "FIB2 (Fibonacci Numbers,
Loop Version)" on page 248.
IFTE (If-Then-Else-End Function)
The first example in this chapter can be written in algebraic syntax by
using the function IFTE:
IFTE(X;o'!0,SINOO/X, 1)
This form is handy for symbolic calculations. If you execute the pro-
gram-structure version while X is undefined, this algebraic form is the
result. The arguments to IFTE must be representable in algebraic syn-
tax; to include RPN commands in the conditional, you must use the
program-structure form.
The IFTE function is used in "FIBl (Fibonacci Numbers, Recursive
Version)" on page 247.
26: Program Structures


Table of Contents

   Also See for HP HP-28S

   Related Manuals for HP HP-28S

Comments to this Manuals

Symbols: 0
Latest comments: