HP 50g User's Reference Manual
Download Advanced user's reference manual of HP 48gII Calculator for Free or View it Online on All-Guides.com.
Brand: HP
Category: Calculator
Type: Advanced user's reference manual
Model: HP 48gII , HP 49g+ , HP 50G
Pages: 693
RPL Programming 1-17
Example: Multiple Conditional Actions.
The following program stores the level 1 argument in a variable if the
argument is a string, list, or program.
Program: Comments:
«
→ y
Defines local variable y.
«
Starts the defining procedure.
CASE
Starts the case structure.
y TYPE 2 SAME
THEN y 'STR' STO END
Case 1: If the argument is a string, stores
it in STR.
y TYPE 5 SAME
THEN y 'LIST' STO END
Case 2: If the argument is a list, stores it
in LIST.
y TYPE 8 SAME
THEN y 'PROG' STO END
Case 3: If the argument is a program,
stores it in PROG.
END
Ends the case structure.
»
Ends the defining procedure.
»
Using Loop Structures
You can use loop structures to execute a part of a program repeatedly. To specify in advance how many times to
repeat the loop, use a definite loop. To use a test to determine whether or not to repeat the loop, use an indefinite loop.
Loop structures let a program execute a sequence of commands several times. Loop structures are built with
commands — called structure words — that work only when used in proper combination with each other. These
loop structure commands are contained in the PRG BRCH menu (!°
%BRCH%
):
START … NEXT and START … STEP.
FOR … NEXT and FOR … STEP
DO … UNTIL … END.
WHILE … REPEAT … END.
In addition, the Σ function provides an alternative to definite loop structures for summations.
Using Definite Loop Structures
Each of the two definite loop structures has two variations:
NEXT. The counter increases by 1 for each loop.
STEP. The counter increases or decreases by a specified amount for each loop.