Returns the width of the current terminal, measured in character columns.
Examples
PRINT "Terminal width = "; TERMWIDTH
REM Draw a border along the top of the screen
CURSOR 1, 1
PRINT STRING$(TERMWIDTH, "-")
REM Centre text horizontally
midX = TERMWIDTH / 2 - (LEN("Hello, world!") / 2)
CURSOR midX, TERMHEIGHT / 2
PRINT "Hello, world!"
Notes
- Value is returned as an integer ≥ 1.
- Useful for horizontal positioning with CURSOR.
- Works together with TERMHEIGHT to adapt output to the current terminal size.
See also: TERMHEIGHT · CURSOR · CURRENTX · CURRENTY