COUNTCOU.

A function returning the number of characters sent to the output stream (VDU or printer) since the last new line.

char_count=COUNT

Characters with an ASCII value of less than 13 (carriage return/new-line/enter) have no effect on COUNT.

Because control characters above 13 are included in COUNT, you cannot reliably use it to find the position of the cursor on the screen. If you need to know the cursor's horizontal position use the POS function.

The example below prints strings from the string array 'words$'. The strings are printed on the same line until the line length exceeds 20. When the line length is in excess of 20, a new-line is printed.

 90 ...
100 PRINT
110 FOR i=1 TO 1000
120 PRINT words$(i);
130 IF COUNT>20 THEN PRINT
140 NEXT
150 ...

Syntax

<n-var>=COUNT

Associated Keywords