Print using – Remote Processing CAMBASIC User Manual

Page 131

Advertising
background image

Comm ands - 98

PRINT USING

Statement

SYNTAX:

PRINT [#n,]USING"format string"; expr ession

PURPOSE:

To pr int strings or number s using a specifie d form at.

REMARK S:

n = v a li d p o r t n u m be r . P o r t n u m be r s a r e 1 a n d 2 f or s er i al ; 9 f o r V F d is p la y ; 10 f or L C D
character and graphics display. L CD and V F displays must be configured using the CONF IG
DISPLAY command before use.

The format string is one or two strings that specify the print format. The three possibilities are:

#

Used to sp ecify the num ber of dig its to be printed on each side o f the decim al point.

$$$$

Used to pr int numbe rs in scientific o r enginee ring notation . T his form at string m ust contain
4 carets a nd be used in c onjunction w ith the # form at string. Failur e to do the latter will
produce unpr edictable results.

.

Used to specify the location of the decimal point in a field determined by the use of #.

NOTE: You cannot print a string expression in the same line containing a format declaration. The

string will be taken as num erical.

RELATED:

PRINT, PRINT$

EXAMPLE:

A = 1.2345
PRINT USING "##.##";A;
1.23

PRINT USING ".##";A
%1.23

The % sign indicates that the number contained digits outside the specified field.

A = 1234.67
PRINT USING "#.##
$$$$";A

0.12E+4

In this case the fir st # specifies the lea ding zero to the left of the dec imal point.

PRINT USING "##.##$$$$;A

1.23E+3

Advertising