Program Branching; Branching With If - HP 49g+ User Manual

Graphing calculator
Hide thumbs Also See for 49g+:
Table of Contents

Advertisement

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.

Branching with IF

In this section we presents examples using the constructs IF...THEN...END and
IF...THEN...ELSE...END.
Page 21-46

Advertisement

Table of Contents
loading

Table of Contents