beautypg.com

HP 9g Graphing Calculator User Manual

Page 27

background image

E-27

INPUT memory variable

Makes the program pause for data input. memory variable = _

appears on the display. Enter a value and press [

]. The value is

assigned to the specified variable, and the program resumes execution.

To input more than one memory variable, separate them with a
semicolon (;).

PRINT “ text ” , memory variable

Print the text specified inside the double quotation marks and the

value of the specified memory variable.

Conditional branching

IF

( condition

) THEN

{

statement

}

IF the condition is true, THEN statement is executed.

IF (

condition

) THEN {

statement

}; ELSE {

statement

}

IF the condition is true, the specified THEN statement is executed,

otherwise the ELSE statement is executed.

Jump commands

Lbl n

An Lbl n command marks a destination point for a GOTO n jump

command. Each label name (Lbl) must be unique (that is, not repeated in
the same program area). The label suffix n must be an integer from 0 to
9.

GOTO n

When program execution encounters a GOTO n statement, execution

jumps to Lbl n (where n is the same value as the n in the GOTO n
statement).

Mainroutine and Subroutine

GOSUB PROG n ;

You can jump between program areas, so that the resulting execution

is made up of code from different program areas. The program from
which other program areas are jumped to is the mainroutine, and an
area jumped to is a subroutine. To cause a jump to a subroutine, enter
PROG n where n is the number of the destination program area.
Note: The GOTO n command does not allow jumps between program
areas. A GOTO n command only jumps to the corresponding label (Lbl)
within the same program area.

End