bas7ex.hlp (Topic list)
Important Notice
The pages on this site contain documentation for very old MS-DOS software, purely for historical purposes. If you're looking for up-to-date documentation, particularly for programming, you should not rely on the information found here, as it will be woefully out of date.
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