TI-92 subroutine programming


[Prev][Next][Index][Thread]

TI-92 subroutine programming



I'm obviously missing something when it comes to using subroutines in
TI-92 programs.  Here is a sample program to illustrate my problem:


test()
Prgm
Local i,k
Define sub(n)=Prgm
   Local j
   Disp n
   Input "Value",j
   Return j
EndPrgm
For i,1,5
   sub(i)->k[i]
EndFor
Disp k
EndPrgm


"->" represents the "STO>" operation.  When I run this program, I get an
"invalid program reference" error.  I tried making k a scalar rather than
a list, and I got the same error.


I can't think of any other ways to call subroutines and have them return
values.  The manual isn't too clear on how to do this.  What am I doing
wrong?  Does the TI-92 even support this type of program structure, or
will I be stuck just cutting and pasting multiple copies of code instead
of using subroutines?


(By the way, I know there is a better way to do what I have illustrated
in the program above.  The program is intended only to illustrate the
problem.  Please don't offer suggestions on how to re-write the above
program without using subroutines.)
<pre>
--
David Rice
<drice@asu.edu>
</pre>