À
Local i
For i,0,5,1
Disp i
EndFor
À
Declares variable
Note: When possible, declare as local any variable that is used only
within the program and does not need to be available after the program
stops.
What causes an undefined variable error message?
An
variable error message displays when you evaluate a user-
Undefined
defined function or run a user-defined program that references a local
variable that is not initialized (assigned a value).
For example:
Define fact(n)=Func
Local m
While n>1
n
m
m: n–1
†
&
EndWhile
À
Local variable
You must initialize local variables
All local variables must be assigned an initial value before they are
referenced.
Define fact(n)=Func
Local m: 1
While n>1
n
m
m: n–1
†
&
EndWhile
À
1 is stored as the initial value for
Note: Functions and programs cannot use a local variable to perform
symbolic calculations.
Programming
i
as local.
À
n
&
m
is not assigned an initial value.
À
m
&
n
&
m
.
331