# HP F2226A - 48GII Graphic Calculator User Manual Page 652

Graphing calculator.

would be replaced by the value that the program uses and then completely
From the point of view of programming, therefore, a global variable is a
variable that is accessible to the user after program execution. It is possible to
use a local variable within the program that is only defined for that program
and will not be available for use after program execution.
The previous
program could be modified to read:
«
«
"
"
→ x
x SINH 1 x SQ ADD /
) is obtained by combining the right-shift key ‚ with
The arrow symbol (
the 0 key, i.e., ‚é. Also, notice that there is an additional set of
programming symbols (« ") indicating the existence of a sub-program,
namely «
", within the main program. The main
x SINH 1 x SQ ADD /
→ x
program starts with the combination
, which represents assigning the
value in level 1 of stack to a local variable x.
Then, programming flow
continues within the sub-program by placing x in the stack, evaluating SINH(x),
placing 1 in the stack, placing x in the stack, squaring x, adding 1 to x, and
2
dividing stack level 2 (SINH(x)) by stack level 1 (1+x
). The program control
is then passed back to the main program, but there are no more commands
between the first set of closing programming symbols (") and the second one,
therefore, the program terminates. The last value in the stack, i.e., SINH(x)/
2
(1+x
), is returned as the program output.
The variable x in the last version of the program never occupies a place
among the variables in your variable menu. It is operated upon within the
calculator memory without affecting any similarly named variable in your
variable menu. For that reason, the variable x in this case is referred to as a
variable local to the program, i.e., a local variable.
Note: To modify program @@@g@@@, place the program name in the stack
(³@@@g@@@ `), then use „˜. Use the arrow keys (š™—˜) to
move about the program. Use the backspace/delete key, ƒ, to delete any
unwanted characters. To add program containers (i.e., « "), use ‚å,
since these symbols come in pairs you will have to enter them at the start and
end of the sub-program and delete one of its components with the delete key
ƒ to produce the required program, namely:
Page 21-3