Search code examples
ti-basic

List consistently deleted when program is run on Ti-89


Whenever I attempt to run a program on my Ti-89 that stores a number or a sequence into a list, the list is always deleted after the program is run. I have tried this sort of thing on a Ti-84, and the number is successfully stored. I was perhaps thinking that it may be due to a specific formatting error. An example program below:

mn()
Prgm
31->c
While c>0
If remain(sqrt(c^2*(c+1)),1)=0
Then
c->list2
EndIf
c-1->c
EndWhile
EndPrgm

Perhaps the number is not stored into the next blank cell and the entire list is cleared/deleted? I know on the Ti-84, one can simply use: c->L2(1+dim(L2)) Which does not seem to work on the Ti-89. Has anyone else had experience with this issue before?


Solution

  • You're not adding an element to list2, you're replacing list2 with the contents of c.

    First: c->list2[1+dim(list2)] does work, you just have to use square brackets for list indexing on an 89, not parentheses.

    Second: you could keep a counter as you go: 1->i at the beginning of the loop, and then
    c->list2[i] : i+1->i for each value.

    Third: augment(list2,{c})->list2 also works, although it's probably the most expensive by far.