Program branching, Program branching ,21-46 – HP 50g Graphing Calculator User Manual

Page 693

Advertising
background image

Page 21-46

The calculator includes also the logical operator SAME. This is a non-standard
logical operator used to determine if two objects are identical. If they are
identical, a value of 1 (true) is returned, if not, a value of 0 (false) is returned.
For example, the following exercise, in RPN mode, returns a value of 0:

‘SQ(2)’ ` 4 ` SAME

Please notice that the use of SAME implies a very strict interpretation of the
word “identical.” For that reason, SQ(2) is not identical to 4, although they
both evaluate, numerically, to 4.

Program branching

Branching of a program flow implies that the program makes a decision among
two or more possible flow paths. The User RPL language provides a number of
commands that can be used for program branching. The menus containing
these commands are accessed through the keystroke sequence:

„°

@)@BRCH@

This menu shows sub-menus for the program constructs

The program constructs IF…THEN..ELSE…END, and CASE…THEN…END will
be referred to as program branching constructs. The remaining constructs,
namely, START, FOR, DO, and WHILE, are appropriate for controlling repetitive
processing within a program and will be referred to as program loop
constructs. The latter types of program constructs are presented in more detail
in a later section.

p

q

p XOR q

1

1

0

1

0

1

0

1

1

0

0

0

Advertising