The hp prime programming language – HP Prime Graphing Wireless Calculator User Manual

Page 255

Advertising
background image

Programming in HP PPL

251

To share a

program

You can send programs between calculators just as you
can send apps, notes, matrices, and lists.

The HP Prime programming language

The HP Prime programming language allows you to
extend the capabilities of the HP Prime by adding
programs, functions and variables to the system. The
programs you write can be either standalone or attached
to an app. The functions and variables you create can be
either local or global. If they are declared to be global,
then they appear in the User menu when you press

D

or

a

. In the following sections, we discuss variables

and functions, then create a set of short programs to
illustrate the various techniques for creating programs,
functions, and variables.

Variables

and visibility

Variables in an HP Prime program can be used to store
numbers, lists, matrices, graphics objects, and strings. The
name of a variable must be a sequence of alphanumeric
characters (letters and numbers), starting with a letter.
Names are case-sensitive, so the variables named
MaxTemp and maxTemp are different.
The HP Prime has built-in variables of various types, visible
globally (that is, visible wherever you are in the
calculator). For example, the built-in variables A to Z can

be used to store real numbers, Z0 to Z9 can be used to

store complex numbers, M0 to M9 can be used to store

matrices and vectors, and so on. These names are
reserved. You cannot use them for other data. For
example, you cannot name a program M1, or store a real

number in a variable named Z8. In addition to these

reserved variables, each HP app has its own reserved
variables. Some examples are Root, Xmin, and
Numstart. Most of these app variables are local to their

app, though a few are global by design. For example, C1

is used by the Statistics 2Var app to store statistical data.
This variable is global so that you can access that data
from anywhere in the system. Again, these names cannot
be used to name a program or store data of a type other
than their design allows. (A full list of system and app
variables is given in chapter 4, “Variables”, beginning on

Advertising