Qualifying the name of a variable – HP Prime Graphing Calculator User Manual

Page 516

Advertising
background image

512

Programming

(that is, on a line above the program name) would be
EXPORT RADIUS. Then, if a value is assigned to
RADIUS, the name appears on the variables menu (

a

)

and is visible globally. This feature allows for extensive
and powerful interactivity among different environments in
the HP Prime. Note that if another program exports a
variable with the same name, the most recently exported
version will be active.
The program below prompts the user for the value of
RADIUS, and exports the variable for use outside the

program.

EXPORT RADIUS;
EXPORT GETRADIUS()
BEGIN
INPUT(RADIUS);
END;

Note that EXPORT

command for the
variable RADIUS

appears before the
heading of the function
where RADIUS is

assigned. After you
execute this program, a
new variable named RADIUS appears on the USER
GETRADIUS section of the Variables menu.

Qualifying

the name of a

variable

The HP Prime has many system variables with names that
are apparently the same. For example, the Function app
has a variable named Xmin, but so too does the Polar

app, the Parametric app, the Sequence app, and the
Solve app. In a program, and in the Home view, you can
refer to a particular version of these variables by
qualifying its name. This is done by entering the name of
the app (or program) that the variable belongs to,
followed by a dot (.), and then the actual variable name.

For example, the qualified variable Function.Xmin

refers to the value of Xmin within the Function app.

Similarly, the qualified variable Parametric.Xmin

refers to the value of Xmin in the Parametric app. Despite

having the same name—Xmin—the variables could have

Advertising