BASIC-80

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 BASIC-80 format characters is explained in the following section.

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 floating-point up to seven digits, and double precision floating-point up to fifteen digits.

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 (-) is used at the right of the format character field to force printing of a trailing minus sign if the number is negative. If it is positive, a space is printed. If neither (+) or (-) is included in the format, a negative number is printed with a leading (-).

PRINT USING" +H.IH"; 4.89; -2.6689

+4.89 -2.67

PRINT USING "IH.H-";-5.8; 96.2

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

6-17

Page 57
Image 57
Intel 9800758-02 manual Numeric fields, If X$=SEVEN and Y$=EIGHT, the results of line 40 would be