QB64.com

QB64 is a modern extended BASIC programming language that retains QBasic/QuickBASIC 4.5 compatibility and compiles native binaries for Windows, Linux, and macOS.

The LINE INPUT statement requests a STRING keyboard entry from a program user.

Syntax

LINE INPUT [;] “[text prompt or question]”{,|;} stringVariable$ LINE INPUT ; stringVariable$

Parameter(s)

Description

Example(s)

Preventing screen roll after an input entry on the bottom 2 screen rows.


SCREEN 12

COLOR 14: LOCATE 29, 2 '          place dursor at beginning of prompt liine
PRINT "Enter a name to search for... "; 'print prompt on screen
COLOR 15: LINE INPUT ; "", name$ '       get search name from user
LOCATE 29, 2: PRINT SPC(78); '       erase previous prompt
n$ = UCASE$(name$) '                 convert search name to upper case
COLOR 14'                        change foreground color to yellow
LOCATE 29, 2: PRINT "Searching..."; 'print message
SLEEP 


Enter a name to search for... █

Explanation: The red semicolon after LINE INPUT acts like a semicolon after a PRINT, which keeps the print cursor on the same row.

See Also