Where column is the zero-based column number (0 to 255) where the next value will print.
The keyword TAB( is four characters; it includes the opening parentheses of the “function”. Although the syntax makes this keyword look like a function, it may only be used as a preposition with PRINT or PRINT#. Any attempt to use it as a function (for example, assign the “result” to a string variable) will generate a SYNTAX ERROR.
This preposition does not generate tabs (character $09 = CHR$(9)) as the name implies! It is not clear why, but Commodore used cursor_right (character $1D = CHR$(29)) instead of space characters. Normally these appear as spaces on screen, but if quote mode or insert mode is active, they will instead appear as a reverse-font right bracket ”]”. If printing is redirected (see CMD) this may cause problems for some devices. Examination of C1541 ROMs (and similar) reveals they had to special-case this obscure character.
This preposition is generally used to seperate multiple values, although it may be used to control printing of the first value as well. It will generate zero, one, or more cursor_right characters (as neccessary) such that the current cursor position will be at the zero-based column for printing of the next value; if the specified column is less than or equal to the current cursor position, then no cursor_right characters are printed.
10 PRINT "0123456789" 20 PRINT TAB(6) "HERE" 30 PRINT "OVER" TAB(6) "THERE" 40 PRINT "OVER" TAB(2) "THERE" RUN 0123456789 HERE OVER THERE OVERTHERE READY.
This page is a member of Commodore BASIC