NAME

input - take input from the keyboard

SYNOPSIS

input[;] [Prompt;] Var[, Var]... 
input[;] [Prompt,] Var[, Var]... 

DESCRIPTION

When a program encounters an input statement, it pauses and first displays Prompt (if included), then a question mark to indicate that it is waiting for data which may be entered from the keyboard.  The data that is entered is assigned to the variable(s) given in the variable list and must agree with the type specified by the variable name.  Prompt is a string constant specifying a prompt string to be output to the terminal.  Var is the name of the variable (numeric or string) or array element which will receive the input.  When more than one data item is to be entered in response to an input request, the individual data items must be separated by commas and the number of items entered must match the number of variables specified in the statement.  When strings are entered in response to an input statement, they need not be surrounded by quotation marks unless they contain commas, colons or significant leading or trailing blanks.  If the optional semicolon follows input, no newline is output after data is entered, leaving the cursor on the same line as the response.  Using a comma instead of a semicolon after the prompt string will suppress the question mark. 

EXAMPLE

The program:
	10 rem Insert statements for data entry here
	   input "Is this data correct"; a$
	   answer$ = left$(a$, 1)
	   if answer$ <> "y" and answer$ <> "Y" then_
		print "Re-enter data" : goto 10
	   rem Insert statements for data processing here
	   end
prompts
	Is this data correct?
The question mark (displayed by the computer) is a prompt requesting the user to make an entry.  In this example if the first letter is either "y" or "Y", the program will go on to process the data just entered.  Otherwise, the program prints "Re-enter data" and returns to the data entry statements at line 10. 

SEE ALSO

input$, input #, inkey$

USAGE NOTES

In Microsoft BASIC, input is used for input from the userís keyboard (terminal) and input # is used for input from disk files.  In the UNIX environment, the distinction between terminals and disk files is not as strong: standard input may be redirected to a disk file or a terminal may be open as a file.  To accommodate this flexibility, the distinction between input and input # must be merely syntactic rather than functional.  Thus,

input #FileNum, [;] [Prompt;] Var[, Var]... 
input #FileNum, [;] [Prompt,] Var[, Var]... 

is the synopsis of the input # statement for terminal input (as described above) when FileNum refers to a file that is a terminal.  Although the organization of these manual pages implies the older, less flexible system, this organization is maintained only for convenience, input and input # do not differ functionally.  The difference in behavior between terminal input and disk file input depends entirely upon the type of file in use. 

If the environment variable BASECHO is set to a non-null value when a Basmark QuickBASIC program begins executing, the BASIC input/output facility operates differently in order to support half-duplex terminals such as the IBM 3278.  In this modified behavior of the input/output facility, the terminal modes are not altered, so that the usual erase and kill processing and echoing of terminal input are performed.  In the specific case of input, appearance of the semicolon following input will not cause suppression of the echo of the newline; the semicolon is simply ignored. 

DIAGNOSTICS

If the number of data items does not match the number of variables in the input statement, the message "?Redo from start" will be printed on the terminal and input attempts to read the data again. 

An "Overflow" error occurs if the value of a data item exceeds the precision of the associated variable. 

from The Basmark QuickBASIC Programmerís Manual by Lawrence Leinweber