Commands and Statements |
As can be seen, PRINT USING "!" prints a string consisting of the first letters of each string. PRINT USING \ 2 spaces \ prints a string consisting of four characters from X$ (3 plus a space) and four from Y$ (also 3 plus a space). If Y$="SEVEN", the result printed when line 40 is executed would be:
ONE SEVE
and if X$="SEVEN" and Y$="EIGHT", the results of line 40 would be:
SEVEEIGH
Numeric fields
The PRINT USING formatting characters specify right justification, leading dollar signs, plus or minus signs, exponentiation, asterisk fills, or insertion of commas. Each of the
IThe number or sharp sign (H) indicates the position of digits. If the number to be printed is too small to fill all of the digit positions specified to the left of the decimal point, leading spaces print to fill the entire field. An integer can print as up to five digits, single precision
•The decimal point can be inserted in any position in the field. If the format specifies that a digit follows the decimal point, the digit always prints, whether it is a 0 or another number. Numbers are rounded as necessary.
PRINT USING "IH.II"; 41.287 41.29
PRINT USING "IH.HI"; 71/100 0.71
+The plus sign (+) is used at the beginning or end of the field of format characters. Insertion of this character prints a plus or minus sign, depending on the sign of the number, at the beginning or end of the number, respectively.
The minus sign
PRINT USING" +H.IH"; 4.89;
+4.89
PRINT USING
5.8- 96.2
**The double asterisk (**) fills any leading blank spaces in the number format with asterisks. This symbol also specifies positions for two more digits.
PRINT USING "**HH.H"; 4.8; 243.3
***4.8 *243.3