Input

=Input and Line Input= toc

Input
The **Input** statement displays a textbox where the user can type. To the right of the textbox is an "Accept" button.

There is an optional text label, which if used appears to the left of the textbox.

The syntax for **Input** is as follows.

INPUT [expr;]var1[,var2...] //- Ask the user for data into 1 or more vars. Optionally display expr as a prompt.//

The variables can be string or numeric types, so use the type that makes sense in your program.

The following demo shows simple input, input into multiple variables, and the optional label for the prompt message.

code format="vbnet" 'simple input statement with a single variable input aVar$

'input statement with multiple string variables for input input var1$, var2$

'input multiple vars with text display input "Type two numbers, separated by commas."; num1, num2 print "Sum is ";num1 + num2 code

Line Input
The **Input** statement retrieves the text typed by the user up to the first comma and places it into a variable. If there is a need for user input to contain commas, use **Line Input** instead. The syntax is:

LINE INPUT var1 //- Ask the user for complete line of text to be placed in var1.//

There is not an option to display a text prompt in **Line Input**.

Here is a small demo that shows the difference between the two statements.

code format="vbnet" print "In each box below, type two words, separated by a comma." input var1$ line input var2$

print "Input from INPUT is """;var1$;"""" print "Input from LINE INPUT is """;var2$;"""" code

If the user typed "one,two" into both input boxes, the output would look like this:

code In each box below, type two words, separated by a comma. ?one,two ?one,two Input from INPUT is "one" Input from LINE INPUT is "one,two" code