Commands and Statements
6-16
PRINT
The
PRINT
statement returns the value
of
expressions
or
the text
of
strings to the
console, or to any
ISIS-II file. Literal strings must be enclosed in quotation marks
(");
variables and expressions need no quotation marks.
You can print data
to
any ISIS-II file by specifying a file number.
If
a comma (,)
is
inserted following
an
expression to be printed, the next printing starts
at
the begin-
ning
of
the next 14-column zone.
If
a semicolon (;)
is
inserted, the next printing
starts
at
the next column.
If
no punctuation
is
used at the end
of
the PRINT state-
ment, the next printing starts
at
the beginning
of
the next line. PRINT by itself
prints one blank line. A
"?"
entered after a line number means PRINT.
PRINT
[II
filenumber,][[
expression],
I;] ...
10
INPUT
"A
string";
X$
20
PRINT
"YOUR
STRING
IS
";X$
30
END
RUN
? A
string
YOUR STRING
IS
A string
Ok
PRINT USING
The PRINT USING statement specifies particular formats to print strings
or
numbers. The format string may include more
than
one field, and may also include
any literal character
that
is
not a
PRINT
USING formatting character. The syntactic
format
of
PRINT
USING
is:
PRINT
[#
file number,] USING format string; expression
[,
expression] ...
in which the format string specifies spacing and additional characters (such as
asterisks and dollar signs) when used with numeric fields, and which specify portions
of
the given string when used with string fields. Each expression
is
printed with the
same format. The optional file number specifies the number
of
an
open file. See
Chapter 5 for details
of
sequential disk file 110.
String Fields
There are two formatting choices when using
PRINT
USING with string fields:
"!"
specifies that the first character
of
each specified string
is
printed.
"\
n spaces
\"
specifies
that
the first 2+N characters are printed.
If
the backslashes
are used without spaces, two characters are printed.
If
the string field has more characters than the format string, the balance are
ignored; if there are fewer characters than specified, spaces are printed to fill out the
field. Here are examples
of
the string field formats:
10
X$="ONE"
20
Y$="TWO"
30
PRINT USING
"!";
X$;
Y$
40
PRINT
USING"
\
\";
X$;
Y$
RUN
OT
ONE TWO
Ok
BASIC-SO