beautypg.com

Evaluating local names – HP 48g Graphing Calculator User Manual

Page 423

Attention! The text in this document has been recognized automatically. To view the original document, you can use the "Original mode".

background image

l

HOME }

4:
3!

10

2:

6

1 =

£0

then

a creates local variable a = 20,

a b creates local variables a = 6 and b = 20.

■ + a b c creates local variables a = 10, 6 = 6, and c = 20.

The defining procedure then uses the local variables to do calculations.

Local variable structures have these advantages:

■ The —+ command stores the values from the stack in the

corresponding variables—you don’t need to explicitly execute STO.

m

Local variables automatically disappear when the defining procedure

for which they are created has completed execution. Consequently,
local variables don’t appear in the VAR menu, and they occupy user

memory only during program execution.

m Different local variable structures can use the same variable names

without conflict.

29

Evaluating Local Names

Local names are evaluated differently from global names. When a

global name is evaluated, the object stored in the corresponding

variable is itself evaluated. (You’ve seen how? programs stored in
global variables are automatically evaluated when the name is

evaluated.)

When a local name is evaluated, the object stored in the

corresponding variable is returned to the stack but is not evaluated.

When a local variable contains a number, the effect is identical to

evaluation of a global name, since putting a number on the stack is

equivalent to evaluating it. However, if a local variable contains a

program, algebraic expression, or global variable name—and if you

Programming the HP 48 29-17

This manual is related to the following products: