HP 48gII Advanced User's Reference Manual page 103

Graphing calculator
Hide thumbs Also See for 48gII:
Table of Contents

Advertisement

Techniques used in NAMES
Nested conditionals. The outer conditional verifies that there are two objects in the list. If so, the inner
!
conditional verifies that both objects are names.
Logical functions. NAMES uses the AND command in the inner conditional to determine if both objects
!
are names, and the NOT command to display the error message if they are not both names.
NAMES program listing
Program:
«
IF
OBJ
DUP 2. SAME
THEN
DROP
IF
TYPE 6. SAME
SWAP TYPE 6. SAME
AND
NOT
THEN
"List needs two names"
DOERR
END
ELSE
DROPN
"Illegal list size"
DOERR
END
»
`ONAMES K
Checksum: # 10752d
Bytes:
141.5
Level 1
"
{ valid list }
"
{ invalid list }
"
Level 1
(error message in status area)
Comments:
Starts the outer conditional structure.
Returns the n objects in the list to levels 2
through (n + 1), and returns the list size n to
level 1.
Copies the list size and tests if it's 2.
If the size is 2, moves the objects to level 1 and
2, and starts the inner conditional structure.
Tests if the object is a name: returns 1 if so,
otherwise 0.
Moves the second object to level 1, then tests if
it is a name (returns 1 or 0).
Combines test results: Returns 1 if both tests
were true, otherwise returns 0.
Reverses the final test result.
If the objects are not both names, displays an
error message and aborts execution.
Ends the inner conditional structure.
If the list size is not 2, drops the list size,
displays an error message, and aborts
execution.
Ends the outer conditional.
Stores the program in NAMES.
RPL Programming Examples 2-25

Hide quick links:

Advertisement

Table of Contents
loading

This manual is also suitable for:

49g+

Table of Contents