Texas Instruments TI-Nspire CX CAS TINSPIRE-CX-CAS Leaflet

Product codes
TINSPIRE-CX-CAS
Page of 603
524 Getting Started with the Program Editor
Local i  
À
For i,0,5,1
  Disp i
EndFor
Disp i
À
Declares variable
i
as local.
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
Undefined
variable error message is displayed when you evaluate a user-
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&n
  EndWhile
  Return m
EndFunc
À
Local variable
m
is not assigned an initial value.
Initialize Local Variables
All local variables must be assigned an initial value before they are referenced.
Define fact(n)=Func
  Local m: 1&m  
À
  While n>1
    n¦m&m: n–1&n
  EndWhile
  Return m
  EndFunc
À
1 is stored as the initial value for
m
.