HP Prime Graphing NW280AAABA manual Programming in HP PPL 513

Models: Prime Graphing NW280AAABA

1 616
Download 616 pages 24.49 Kb
Page 519
Image 519

Qualifying the name of a variable

Functions, their arguments, and parameters

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.

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 different values. You do likewise to use a local variable in a program: specify the name of the program, followed by the dot, and then the variable name.

You can define your own functions in a program, and data can be passed to a function using parameters. Functions can return a value (using the RETURN statement) or not. When a program is executed from Home view, the program will return the value returned by the last statement that was executed.

Furthermore, functions can be defined in a program and exported for use by other programs, in much the same way that variables can be defined and used elsewhere.

In this section, we will create a small set of programs, each illustrating some aspect of programming in the HP Prime. Each program will be used as a building block for a custom app described in the next section, App Programs.

Programming in HP PPL

513

Page 519
Image 519
HP Prime Graphing NW280AAABA manual Programming in HP PPL 513