Description:
This statement displays an optional prompt in the current output window, then waits for the user to enter data from the keyboard. The entered data is displayed in the window (to the right of the prompt, if any) as the user types it. When the user finishes entering the data, the data are assigned to the variables var1, var2 etc., and the program then continues execution at the next statement. This is a simple (but old-fashioned) way to let the user interact with the program.

Specifier

Description

"prompt";

If you specify this parameter, the literal string inside the quotes is displayed as a prompt. The input cursor is displayed just to the right of the prompt.

var1[,var2...]

These must be string or numeric variables (not record variables). The data that the user enters are assigned to these variables according to the rules explained below.

Variable Assignment
The input statement expects the user to enter data as a sequence of data items separated by commas or tabs as in this example:23, green, -15.7
23 [tab] green [tab] -15.7 [cr]
Subsequent text will refer to the more common comma delimiter, but works also with tabs.
Each one of the comma-delimited items is assigned (after some conversion, if necessary) to a separate variable in the var1 [,var2...] list. If the user enters more items than the number of variables in the list, the extra entered items are ignored. If the user enters fewer items than the number of variables in the list, then zeros or null strings are assigned to the extra variables.
The items may undergo some conversion before being assigned to the variables:

If the variable is a string variable, leading spaces are stripped from the item (trailing spaces are not stripped).

If the variable is a numeric variable but the entered item is a string that can't be interpreted as a number, then 0 is assigned to the variable.

If the variable is a numeric variable and the entered item is numeric, then it is subject to the same kinds of conversion as if the item were assigned via an assignment statement. For example, the item's value may be rounded to an integer, or excess digits of precision may be dropped.

Quoted Items
By surrounding an entered item with double quotes, the user can exercise more control over how the item is assigned to a (string) variable. FutureBasic always strips the surrounding quotes from the item before assigning the string to the variable; however:

Leading and trailing spaces inside the quotes are preserved;

A comma that occurs inside the quotes is considered part of the item, rather than a delimiter between items.

Therefore, if the user needs to input an item which has leading blanks, or which contains a comma, then he or she should surround the item with double quotes when typing it in. To assign an arbitrary line of entered text to a string variable without the need for enclosing quotes, use the line input statement.

edit field vs. inputinput is an old-fashioned way of getting keyboard input. A more appropriate and "Macintosh-like" way to get input is to use the edit field statement.