When you are making programs, you might come across a situation in which you need to display several variables on the same line. Therefore, you do something like this:

Output(1,1,variable_1) <-- Display variable_1. Output(1,2,"<some text here>" <-- Display some text you might want to display between the variables. Output(1,3,variable_2) <-- Display variable_2.

You can display your two variables on the first line, as long as the first variable is one digit. However, when the first variable becomes bigger then 9, you get into trouble. That's why you might consider to add an if-loop:

Output(1,1,variable_1) If variable_1<10:2→B <-- If variable_1 is smaller then 10, store 2 into B. If variable_1>10 and variable_1<100:3→B <-- If variable_1 is bigger then 10 and smaller then 100, store 3 into B. If variable_1>100 and variable_1<1000:4→B <-- If variable_1 is bigger then 100 and smaller then 1000, store 4 into B. Output(1,B,"<some text here>" Output(1,B+<digits of text>,variable_2)

An easier method to do the same process is to use log(variable_1)

Output(1,1,variable_1) Output(1,2+ipart(log(variable_1)),"Text" Output(1,6+ipart(log(variable_1)),variable_2 <-- The starting Y variable is a 6 because "TEXT" is 4 letters

What taking the log of a single digit number, log(x) returns with a value that is below 1. If you take the log of a double digit number, log(x) returns with a value that is above 1 and below 2. The command ipart(x) returns with the number rounded down to its base integer. Therefore, if you take the ipart(log(x)) then you will end up with the number of digits minus 1. This is useful because it allows you to prepare for any length of variable without going through massive amounts of code.

Although this is an improvement to the first piece of coding, it doesn't quite cover every single possible situation as we consider variable_1 to be an integer.

Due to this problem, I had some problems with my program Perfect Pythagoras. That's why I came up with a solution:

Output(1,1,variable_1) variable_1→A <-- You do not want to play around with the actual value, so store it into another variable. 1→B <-- Store 1 into B. You'll see. Repeat A<1 <-- Repeat until A is smaller then 1. A/10→A <-- Divide A by 10. B+1→B <-- Add 1 to B. B determines the number of colomns "<some text here>" will need to move. End <-- Stop the repeat-loop. Output(1,B,"<some text here>") Output(1,B+<digits of text>,variable_2)

This does cover every single situation, as long as variable_1 is an integer and variable A and B were not used. Of course you can just exchange A and B with any variable, as long as you're consistent.

When variable_1 is NOT an integer, or you are not absolutely sure it is, it's better to use a larger loop. Like this:

Output(1,1,variable_1) iPart(variable_1)→A <-- Store the part before the . into another value, because you do not want to change it. fPart(variable_1)→B <-- Store the part after the . into another value, because you do not want to change it. 1→C <-- Store 1 into C. C will determine the number of colomns <some text here> will need to be moved. If A=0:Goto 0 <-- If it was a number smaller then 1, TI has the strange habit to not display the 0. So we need another label to fix that. Repeat A<1 <-- Repeat until A is smaller then 1. A/10→A <-- Divide A by 10. C+1→C <-- Add 1 to C. End <-- End the repeat-loop. Lbl 0 <-- If the number was smaller then 1, it'll skip until here. If B≠int(B):Goto 1 <-- If variable_1 was an integer, go to label 0, because the part behind the . will be 0 then. C+1→C <-- Add 1 to C. This is needed because of the ".". Repeat B=int(B) <-- Repeat until B is the same as int(B), so the part after the . will be 0. B*10→B <-- Multiply B by 10. C+1→C <-- Add 1 to C. End <-- End the repeat-loop. Lbl 1 <-- Go here if there wasn't any point in the number. Output(1,F,"<some text here>") Output(1,F+<number of digits of text>,variable_2

This does cover every possible situation possible. Personally I find it strange that TI didn't provide a command for this subject. If anyone of you finds a command doing the exact same thing, please inform me about it.

Another way to do it:

A (variable you want to determine length of) (0,1)->L1 (0,A)->L2 Linreg(ax+b) Y1 Equ-str(sub(Y1,1,length(Y1)-3),Str0)]

Your variable will be in Str0.