
Page 21-47
The IF…THEN…END construct
The IF…THEN…END is the simplest of the IF program constructs. The general
format of this construct is:
IF
logical_statement
THEN
program_statements
END
.
The operation of this construct is as follows:
1. Evaluate
logical_statement.
2. If logical_statement is true, perform program _statements and continue
program flow after the END statement.
3. If logical_statement is false, skip program_statements and continue
program flow after the END statement.
To type in the particles IF, THEN, ELSE, and END, use:
„°
@)@BRCH@ @)@IF@@
The functions
@@@IF@@ @@THEN @@ELSE@ @@ END@@
are available in that menu to be typed
selectively by the user. Alternatively, to produce an IF…THEN…END
construct directly on the stack, use:
„°
@)@BRCH@
„
@)@IF@@
This will create the following input in the stack:
With the cursor
in front of the IF statement prompting the user for the logical
statement that will activate the IF construct when the program is executed.
Example: Type in the following program:
«
→
x
«
IF
‘
x<3
’
THEN
‘
x^2
‘
EVAL END
”
Done
”
MSGBOX
»
»
Содержание 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 ...