78
User's
Handbook
to
the
Atari
400/ 800
Computers
If
line
200
was
revised
as
follows,
200
X$
=
"JOHN"
the
following
could
be
output:
JOHN JOHNSON
The
addition
of
a blank space in
X$
results in one
additional
blank
space
being
output.
CHR$
& ASC Functions
As
mentioned
earlier, characters are represented
with
the Atari
as
ASCII codes. Atari BASIC's CHR$
function
can be used
to
translate
an
ASCII code
to
its equivalent character. The
following
short program illustrates the
use
of
the CHR$
function.
100
PRINT CHR$
(54)
200
PRINT CHR$
(55)
300
END
RUN
6
7
The CHR$
function
is
often
used to represent characters in a
statement,
when
that character can
not
be
represented in
its
text
form. For
example, in the
following
program,
100
PRINT CHR$(34); "JOHN
JOHNSON";
CHR$(34)
200
END
RUN
"JOHN
JOHNSON"
quotation
marks are specified in th e PRINT statement using
their
ASCII code and the CHR$
function
.
The
ASC
function
returns the ASCII code equivalent
for
its string
argument.
If
this string
is
longer than
one
character, the
ASC
function
returns the ASCII code for just the first character in the
stri ng.