Right justification on screen

From Ninerpedia
Jump to navigation Jump to search
The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.

Right justification on screen when printing variables which have a different length.

In Extended BASIC you would use the extended command PRINT USING but in TI BASIC you need to carry out the formatting yourself.

Here is a quick routine for right justification (useful when using columns of numbers).

The variable to be printed is in the string variable A$

To convert numbers to strings use eg STR$(42)

Place the value of the rightmost column to be used in variable RC:

           X=RC-LEN(A$)
           FOR C=1 TO X
           A$=" "&A$     (this adds one space in front of A$)
           NEXT C
           PRINT A$