Difference between revisions of "Right justification on screen"

From Ninerpedia
Jump to navigation Jump to search
(Short article on how to right justify a printout of variables in TI Basic)
 
(add links to ExBas and TI Basic)
 
Line 1: Line 1:
Right justification on screen when printing variables which have a different length.
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.
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).  
Here is a quick routine for right justification (useful when using columns of numbers).  

Latest revision as of 21:12, 5 January 2015

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$