53. String formatting ~~~~~~~~~~~~~~~~~ A statement such as < PRINT A$, > doesn't do what you would expect, and that < PRINT A$,; > is needed to prevent an unwanted linefeed. If you try the first program below, you will see that this only works for 27 passes of a FOR-NEXT loop, after which odd things happen. The simplest cure is probably to pad the string out with spaces, and not use commas at all. Note that two line 100's are given, and they each give a slightly different effect, depending on whether you want to pad the string at the beginning or the end. You can change the figure 10 in line 100 to 4,5,10,20 etc., ie. something that will divide into the screen width of 20,40 or 80. 10 A$="ABCD":FOR S%=1 TO 60:PRINT A$,;:NEXT:PRINT 10 A$="ABCD":FOR S%=1 TO 60:PRINT FNpad(A$);:NEXT:PRINT:END 100 DEF FNpad(x$):=x$+STRING$(10-LEN(x$)," ") 100 DEF FNpad(x$):=STRING$(10-LEN(x$)," ")+x$