Programming 584
In the example above, the local variable m exists independently of any variable m that
exists outside of the function.
You Must Initialize Local Variables
All local variables must be assigned an initial value before they are referenced.
Ê
1 is stored as the initial value for m.
The calculator cannot use a local variable to perform symbolic calculations.
To Perform Symbolic Calculations
If you want a function or program to perform symbolic calculations, you must use a
global variable instead of a local. However, you must be certain that the global variable
does not already exist outside of the program. The following methods can help.
• Refer to a global variable name, typically with two or more characters, that is not
likely to exist outside of the function or program.
•Include
DelVar within the function or program to delete the global variable, if it exists,
before referring to it. (
DelVar does not delete locked or archived variables.)
Ê
Define fact(n)=Func:
Local m: 1!m:
While n>1:
nùm!m: n–1!n:
EndWhile:
Return m:
EndFunc