beautypg.com

Commands under the tmplt menu, Block, Branch – HP Prime Graphing Wireless Calculator User Manual

Page 272: Commands, Under the tmplt menu, Commands under the tmplt menu block

background image

268

Programming in HP PPL

Commands under the Tmplt menu

Block

The block commands determine the beginning and end of
a sub-routine or function. There is also a Return

command to recall results from sub-routines or functions.

BEGIN END

Syntax: BEGIN command1; command2;…;
commandN; END;
Defines a command or set of commands to be executed
together. In the simple program:

EXPORT SQM1(X)
BEGIN
RETURN X^2-1;
END;

the block is the single RETURN command.
If you entered SQM1(8) in Home view, the result returned

would be 63.

RETURN

Syntax: RETURN expression;
Returns the current value of expression.

KILL

Syntax: KILL;
Stops the step-by-step execution of the current program

(with debug).

Branch

In what follows, the plural word commands refers to both
a single command or a set of commands.

IF THEN

Syntax: IF test THEN commands END;
Evaluate test. If test is true (not 0), executes commands.
Otherwise, nothing happens.

IF THEN ELSE

Syntax: IF test THEN commands1 ELSE commands 2
END;
Evaluate test. If test is true (non 0), executes commands 1,
otherwise, executes commands 2