Programming
598
Example of a Local Variable
Example of a Local Variable
Example of a Local Variable
Example of a Local Variable
The following program segment shows a
For...EndFor loop
(which is discussed later in
this module). The variable
i
is the loop counter. In most cases, the variable
i
is used only
while the program is running.
Ê
Declares variable
i
as local.
Note:
As often as possible, use local variables for any variable that is used only within a
program and does not need to be stored after the program stops.
If you declare variable
i
as local, it is deleted automatically when the program stops so
that it does not use up memory.
What Causes an Undefined Variable Error Message?
What Causes an Undefined Variable Error Message?
What Causes an Undefined Variable Error Message?
What Causes an Undefined Variable Error Message?
An
Undefined
variable error message displays 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).
This example is a multi-statement function, rather than a program. Line breaks are
shown here, but you would type the text in the entry line as one continuous line, such as:
Define fact(n)=Func:Local…
where the ellipsis indicates the entry line text continues off-
screen.
Ê
:Local I
:For i,0,5,1
: Disp I
:EndFor
:Disp i
Содержание Voyage 200
Страница 36: ...Getting Started 36 D B D B Press Result ...
Страница 45: ...Getting Started 45 3 0 D B D D B D Press Result ...
Страница 46: ...Getting Started 46 D 2 0 0 2 D B Scroll down to October and press Press Result ...
Страница 60: ...Getting Started 60 B D Press Result ...
Страница 139: ...Previews 139 8 Complete the operation Press 2 d Steps and keystrokes Display 5 f 2 ...
Страница 181: ...Operating the Calculator 181 From the Keyboard From the Keyboard From the Keyboard From the Keyboard ...
Страница 453: ...Differential Equation Graphing 453 ...
Страница 468: ...Tables 468 ...
Страница 515: ...Split Screens 515 Note Both Top Bottom and Left Right splits use the same methods to select an application ...
Страница 777: ...Activities 777 ...