Programming
693
À
Declares the subroutine as a local variable.
Á
Defines the subroutine.
Â
Calls the subroutine.
Note:
Use the Program Editor’s
Var
menu to enter the
Define
and
Prgm...EndPrgm
commands.
Notes about using subroutines
At the end of a subroutine, execution returns to the calling program. To
exit a subroutine at any other time, use
Return
with no argument.
A subroutine cannot access local variables declared in the calling
program. Likewise, the calling program cannot access local variables
declared in a subroutine.
Lbl
commands are local to the programs in which they are located.
Therefore, a
Goto
command in the calling program cannot branch to a
label in a subroutine or vice versa.
Avoiding circular-definition errors
When evaluating a user-defined function or running a program, you can
specify an argument that includes the same variable that was used to
define the function or create the program. However, to avoid circular-
definition errors, you must assign a value for variables that are used in
evaluating the function or running the program. For example:
– or –
Define subtest1()=
Prgm
local subtest2
À
Define subtest2(x,y)=
Á
Prgm
Disp x,y
EndPrgm
©Beginning of main program
For i,1,4,1
subtest2(i,I*1000)
Â
EndFor
EndPrgm
x+1
&
x
À
Summary of Contents for TI-Nspire
Page 38: ...26 Setting up the TI Nspire Navigator Teacher Software ...
Page 46: ...34 Getting started with the TI Nspire Navigator Teacher Software ...
Page 84: ...72 Using the Content Workspace ...
Page 180: ...168 Capturing Screens ...
Page 256: ...244 Embedding documents in web pages ...
Page 336: ...324 Polling students ...
Page 374: ...362 Using the Review Workspace ...
Page 436: ...424 Calculator ...
Page 450: ...438 Using Variables ...
Page 602: ...590 Using Lists Spreadsheet ...
Page 676: ...664 Using Notes You can also change the sample size and restart the sampling ...
Page 684: ...672 Libraries ...
Page 714: ...702 Programming ...
Page 828: ...816 Data Collection and Analysis ...
Page 846: ...834 Regulatory Information ...
Page 848: ...836 ...