beautypg.com

Example – HP 39g Graphing Calculator User Manual

Page 226

Attention! The text in this document has been recognized automatically. To view the original document, you can use the "Original mode".

background image

IF... THEN...

Executes the true-clause sequence of commands if the test-

ELSE... END

clause is true, or thefalse-clause sequence of commands if the

test-clause is false.

IF test-clause

THEN true-clause ELSE false-clause END

Example

l^A :
IF A==l

THEN MSGBOX A
ELSE MSGBOX A

END

EQUALS 1" :

IS NOT EQUAL TO 1

CASE...END

Executes a series of test-clause commands that execute the

appropriate true-clause sequence of commands. Its syntax is:

CASE

IF test-clause I THEN true-clause i END

IF test-clause

2

THEN true-clause

2

END

IFERR.

THEN..

END...

IF test-clause^ THEN true-clause,^ END

END

When CASE is executed, test-clause^ is evaluated. If the test

is true, true-clause^ is executed, and execution skips to END.

If test-clauseif false, execution proceeds to test-clause

2

-

Execution with the CASE structure continues until a true-
clause is executed (or until all the test-clauses evaluate to
false).

Many conditions are automatically recognized by the HP

39G/40G as error conditions and are automatically treated as

errors in programs.

IFERR...THEN...END allows a program to intercept error
conditions that otherwise would cause the program to abort.
Its syntax is:

IFERR trap-clause

THEN error-clause END

15-18

Programming