RPL Programming 1-9
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 want it evaluated ā the program should
execute EVAL after the object is put on the stack.
Defining the Scope of Local Variables
Local variables exist only inside the defining procedure.
Example: The following program excerpt illustrates the availability of local variables in nested defining
procedures (procedures within procedures). Because local variables a, b, and c already exist when the defining
procedure for local variables d, e, and f is executed, they're available for use in that procedure.
Program: Comments:
"
.
.
.
No local variables are available.
!#!$!%!&!!
Defines local variables a, b, c.
!"!
!!$!%!'!&!'!!
!!#!(!)!*!
!!+$,-(.)'*/+!
Local variables a, b, c are
available in this procedure.
Defines local variables d, e, f.
Local variables a, b, c and d, e, f
are available in this procedure.
!$!&!,!0!
!1!
.
.
.
1!
Only local variables a, b, c are
available.
No local variables are available.