IF... THEN... ELSE...

END

CASE...END

IFERR...

THEN...

ELSE…

END...

Example

1 A : IF A==1

THEN MSGBOX " A EQUALS 1" : 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

atrue-clause is executed (or until all the test-clauses evaluate to false).

Many conditions are automatically recognized by the HP 39gs as error conditions and are automatically treated as errors in programs.

18-18

Programming