POS Function Programming Example
◄Example► ◄Contents► ◄Index► ◄Back►
──────────────────────────────────────────────────────────────────────────────
'This example uses the POS function to start a new line after every 40
'characters.
CLS 'Clear screen.
PRINT "This program starts a new line after every 40"
PRINT "characters you type. Press <CTRL-C> to end."
PRINT
DO
DO WHILE POS(0) < 41 'Stay on same line until 40 characters
DO 'printed.
Char$ = INKEY$
LOOP WHILE Char$ = ""
'If input is key combination CTRL-C then end; otherwise,
'print the character.
IF ASC(Char$) = 3 THEN END ELSE PRINT Char$;
LOOP
PRINT 'Print a new line.
LOOP