Reference Guide
2-24 RPL Programming Examples
Program: Comments:
UNTIL 'm' EVAL 0 ==
Repeat the DO...UNTIL loop until m =
0 (i.e. all decimal value have been
accounted for).
END
IF 1 FS?C
Is flag 1 set? Clear the flag after the test.
THEN "0" +
Then add a placeholding zero to the
result string.
WHILE i 'k' EVAL
- 0 ‹
Begin WHILE...REPEAT loop to
determine if additional placeholding
zeros are needed.
Loop repeats as long as i≠k.
REPEAT "0" +
1 'k' STO+
Add an additional placeholding zero and
increment k before repeating the test-
clause.
END
END
»
End the WHILE...REPEAT...END
loop, the IF...THEN...END structure,
and the inner local variable structure.
" base" b +
n SWAP + →TAG
End the outermost
IF...THEN...ELSE...END structure and
create the label string and tag the result
string using the original arguments.
f STOF
Restore original flag settings.
»
»
`O
nBASE K
Stores the program in nBASE.
Checksum: # 54850d
Bytes: 433
Example:
Convert 1000
10
to base 23.
1000
`
23
J
%NBASE%
Verifying Program Arguments
The two utility programs in this section verify that the argument to a program is the correct object type.
NAMES verifies that a list argument contains exactly two names.
VFY verifies that the argument is either a name or a list containing exactly two names. It calls NAMES if the
argument is a list.
You can modify these utilities to verify other object types and object content.