: [[INPUT]] [;] "[Question or statement text]"{,|;} {{Parameter|variable}}[, ...]
: [[INPUT]] ; {{Parameter|variable}}[, ...]
{{Parameters}}
* A [[semicolon]] after the [[INPUT]] keyword keeps the entry on the same row after enter is pressed and prevents the screen contents from rolling up.
* The optional prompt "Question or statement text" must be a literal predefined [[STRING|string]]. '''The prompt cannot use a variable.'''
* [[Quotation mark]]s are required except when a semicolon follows [[INPUT]]. A question mark will appear before the cursor.
* A [[semicolon]] immediately after the text statement will display a question mark with a space after it. Use a [[comma]] for input statements.
{{PageDescription}}
* '''QB64''' does not return ''Redo from start'' errors like QBasic did, as user input is limited to the scope of the variable [[Data types|type]] used.
* Text entries (with a [[STRING]] variable]] can receive any characters, including numerical. '''QB64 will ignore commas in single variable text entries.'''
* The [[Data types|type]] of the {{Parameter|variable}} used to store user input determines the valid numerical range for value entries in QB64, with non-numerical characters limited to D, E, [[&H]], [[&O]] or [[&B]].
** For example, if you use an [[INTEGER]] variable, as in {{InlineCode}}INPUT "Initial value: ", myValue%{{InlineCodeEnd}}, the valid range is -32768 to 32767.
** [[INTEGER]], [[LONG]], and [[_INTEGER64]] entries will ignore decimal points entered and will use all numbers.
* INPUT can be used to get more than one {{Parameter|variable}} value from the user. Do so by separating input variables with commas in the code.
** The program must inform the user that more than one variable is requested, in order to enter each value separated with a comma at runtime.
** [[STRING|String]] and numerical variables can both be used in multiple entry requests separated by commas.
** '''QB64''' allows comma separated entries to be skipped by the user without generating an error.
* '''Use [[LINE INPUT]] for text input entries that may contain commas such as address or name entries.'''
* The user must press enter for the INPUT procedure to end. <!-- redundant: Multiple entries can be skipped. -->
* [[INPUT]] accepts the [[scientific notation]] letters D or E in [[SINGLE]] or [[DOUBLE]] numerical values.
* Numerical values starting with [[&H]], [[&O]] and [[&B]] can also be entered.
<!-- not valid for QB64, not worth mentioning then denying: * INPUT removes all leading or trailing spaces in a string value entry. '''QB64 does NOT remove those spaces!''' -->
* The statement halts a program until enter is pressed, which may not be desired in programs using mouse input (see [[INKEY$]] loops).
* Use [[_DEST]] [[_CONSOLE]] before INPUT statements to receive input from a [[$CONSOLE|console]] window.
{{PageExamples}}
''Example 1:'' Using a variable in an input text message using PRINT. INPUT prompts cannot use variables.
{{OutputStart}}{{text|Enter a name to search for...|#FFFF00}} █
{{OutputEnd}}
: ''Explanation:'' The {{text|red|red}} [[semicolon]] after INPUT acts like a semicolon after a [[PRINT]], which keeps the print cursor on the same row.