Search code examples
ti-basic

How to turn a string into a variable? (TI-84)


I'm trying to turn a string into a variable on my TI-84.

For example,

"XYZ"→Str0
fnInt(X²,sub(Str0,1,1),0,1)→A

But it's not letting me.

I know this seems like a really inefficient way of doing it (why not just do fnInt(X²,X,0,1)?), but in my program this would be very, very useful.

So is there a way to turn a string into a variable?


Solution

  • I don't think you can use a string where fnInt( expects a variable. The only thing I can recommend is to use a bunch of if statements, using I as the index of the variable you're using from your string. Basically, you'd have to write out these cases explicitly, since there's no way to make a string get interpreted as a variable for that function.

    If I=1:fnInt(X²,X,0,1)→A
    If I=2:fnInt(X²,Y,0,1)→A
    If I=3:fnInt(X²,Z,0,1)→A