
Page 21-48
and save it under the name ‘f1’. Press
J
and verify that variable
@@@f1@@@
is
indeed available in your variable menu. Verify the following results:
0
@@@f1@@@
Result: 0
1.2
@@@f1@@@
Result: 1.44
3.5
@@@f1@@@
Result: no action
10
@@@f1@@@
Result: no action
These results confirm the correct operation of the IF…THEN…END construct.
The program, as written, calculates the function f
1
(x) = x
2
, if x < 3 (and not
output otherwise).
The IF…THEN…ELSE…END construct
The IF…THEN…ELSE…END construct permits two alternative program flow
paths based on the truth value of the logical_statement. The general format of
this construct is:
IF
logical_statement
THEN
program_statements_if_true
ELSE
program_statements_if_false
END
.
The operation of this construct is as follows:
1. Evaluate
logical_statement.
2. If logical_statement is true, perform program statements_if_true and
continue program flow after the END statement.
3. If logical_statement is false, perform program statements_if_false and
continue program flow after the END statement.
To produce an IF…THEN…ELSE…END construct directly on the stack, use:
„°
@)@BRCH@
‚
@)@IF@@
This will create the following input in the stack:
Example: Type in the following program:
Содержание 49g+
Страница 1: ...hp 49g graphing calculator user s guide H Edition 4 HP part number F2228 90006 ...
Страница 197: ...Page 5 30 LIN LNCOLLECT POWEREXPAND SIMPLIFY ...
Страница 377: ...Page 11 55 Function KER Function MKISOM ...
Страница 457: ...Page 13 26 In the right hand side figure above we are using the line editor to see the series expansion in detail ...
Страница 775: ...Page 26 10 the location of the backup battery in the top compartment at the back of the calculator ...
Страница 838: ...Page L 5 ...