You are on page 1of 1

GW-BASIC User's Guide

PRINT USING Statement


Purpose:
To print strings or numbers using a specified format.

Syntax:
PRINT USING string expressions;list of expressions[;]

Comments:
string expressions is a string literal or variable consisting of special formatting characters.
The formatting characters determine the field and the format of printed strings or numbers.
list of expressions consists of the string or numeric expressions separated by semicolons.

String Fields
The following three characters may be used to format the string field:
! Specifies that only the first character in the string is to be printed.
\n spaces\ Specifies that 2+n characters from the string are to be printed.
If the backslashes are typed with no spaces, two characters are printed; if the
backslashes are typed with one space, three characters are printed, and so on.
If the string is longer than the field, the extra characters are ignored. If the field is
longer than the string, the string is left-justified in the field and padded with spaces
on the right. For example:
10 A$="LOOK": B$="OUT"
30 PRINT USING "!"; A$; B$
40 PRINT USING"\ \"; A$; B$
50 PRINT USING"\ \"; A$; B$;"!!"
RUN
LO
LOOKOUT
LOOK OUT!!

file:///C|/Documents%20and%20Settings/Lorenzo/Desktop/GW%20Basic/PRINTUSING.html (1 of 4)28/03/2004 21.29.32

You might also like