Chapter
10
I
BASIC Keywords
POS
Function
POS(
number)
Returns the current column position
of
the cursor.
Number
is a dummy argument.
POS returns
a
number in the range
1
to
80, indicating the cur-
rent cursor-column position on the display.
Example
PRINT TFIB(40) POS(0)
prints 40. The PRINT TAB statement moves the cursor
to
Posi-
tion 40; therefore, POS(0) returns the value 40. (However, be-
cause a blank
is
inserted before the “4”
to
accommodate the
sign, the “4” is actually
at
Position 41.)
Sample Program
150 CLS
160 FIF
=
INKEYF
170
IF
A$
=
I”’
THEN 160
180
IF
POS(X)
>
70 THEN IF
A$
=
CHRF(32) THEN
FIB
=
CHRF(13)
200 LPRINT
FIB;
210 GOT0 160
This program lets you use your printer as
a
typewriter (except
that you cannot correct mistakes). Your computer keyboard
is
the typewriter keyboard. Everything you type is printed on your
printer. The program also makes sure that no word is divided
between two lines.
269