
Delete the contents of a program
You can clear the contents of a program without deleting the program. The program then just has a name and
nothing else.
1. Open the Program Catalog.
2. Tap the program to open it.
3.
Press (Clear).
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 or . 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 dierent.
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 the “Variables” chapter.)
In a program you can declare variables for use only within a particular function. This is done using a LOCAL
declaration. The use of local variables enables you to declare and use variables that will not aect the rest of
the calculator. Local variables are not bound to a particular type; that is, you can store oating-point
numbers, integers, lists, matrices, and symbolic expressions in a variable with any local name. Although the
system will allow you to store dierent types in the same local variable, this is poor programming practice
and should be avoided.
Variables declared in a program should have descriptive names. For example, a variable used to store the
radius of a circle is better named RADIUS than VGFTRFG. You are more likely to remember what the variable
is used for if its name matches its purpose.
The HP Prime programming language 567
Komentarze do niniejszej Instrukcji