CASCMD

Type: Command

Description: Displays a list of CAS operations. Selecting one with OK displays a description, related operations, an example of the operation, and the option to copy the example to the command line. More details are given in Appendix C and Appendix H of the User’s Guide. If level 1 of the stack contains a string, the list of CAS operations will be displayed beginning at this point.

Access:

Catalog, …µ, or tools IL

 

See also:

HELP

 

CASE

Command

 

Type:

 

Description:

CASE Conditional Structure Command: Starts CASE … END conditional structure.

 

The CASE … END structure executes a series of cases (tests). The first test that returns a true

 

result causes execution of the corresponding truec lause, ending the CASE … END structure. A

 

default clause can also be included: this clause executes if all tests evaluate to false. The CASE

 

command is available in RPN programming only. You cannot use it in algebraic programming.

 

The CASE … END structure has this syntax:

 

CASE

 

 

testclause 1 THEN trueclause 1 END

 

 

testclause 2 THEN trueclause 2 END

 

 

.

 

 

.

 

 

testclause n THEN trueclause n END

 

 

defaultclause (optional)

 

 

END

 

 

When CASE executes, testclause 1 is evaluated. If the test is true, trueclause 1 executes, then

 

execution skips to END. If testclause 1 is false, testclause 2 executes. Execution within the CASE

 

structure continues until a true clause is executed, or until all the test clauses evaluate to false. If

 

the default clause is included, it executes if all test clauses evaluate to false.

Access:

BRCH CASE

( °is the leftshift of the Nkey).

Input/Output:

Level 1/Argument 1

Level 1/Item 1

 

 

CASE

THEN

T/F

END

END

 

 

Example: The following program takes a numeric argument from the stack:

if the argument is negative, it is added to itself

if the argument is positive, it is negated

if the argument is zero, the program aborts

« → X « CASE

'X>0' THEN X NEG END 'X<0' THEN X DUP + END 'X==0' THEN 0 DOERR END END » »

See also: END, IF, IFERR, THEN

332 Full Command and Function Reference

Page 152
Image 152
HP 50g Graphing, 48gII Graphing manual Cascmd, Case, Help