IF... THEN...

ELSE... END

CASE...END

IFERR...

THEN...

END...

Executes the true-clausesequence of commands if the test- clause is true, or the false-clausesequence of commands if the test-clauseis false.

IF test–clause

THEN true-clause ELSE false-clause END

Example

1&A : IF A==1

THEN MSGBOX A " EQUALS 1" :

ELSE MSGBOX A " IS NOT EQUAL TO 1" : END

Executes a series of test-clause commands that execute the appropriate true-clausesequence of commands. Its syntax is:

CASE

IF test-clause1THEN true-clause1END

IF test-clause2THEN true-clause2END

.

.

.

IF test-clausenTHEN true-clausenEND

END

When CASE is executed, test-clause1is evaluated. If the test is true, true-clause1is executed, and execution skips to END. If test-clause1if false, execution proceeds to test-clause2.

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