17.07.2013 Views

GWBASIC User's Manual

GWBASIC User's Manual

GWBASIC User's Manual

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

GW-BASIC <strong>User's</strong> Guide<br />

INPUT Statement<br />

Purpose:<br />

To prepare the program for input from the terminal during program execution.<br />

Syntax:<br />

INPUT[;][prompt string;] list of variables<br />

INPUT[;][prompt string,] list of variables<br />

Comments:<br />

prompt string is a request for data to be supplied during program execution.<br />

list of variables contains the variable(s) that stores the data in the prompt string.<br />

Each data item in the prompt string must be surrounded by double quotation marks, followed by a<br />

semicolon or comma and the name of the variable to which it will be assigned. If more than one<br />

variable is given, data items must be separated by commas.<br />

The data entered is assigned to the variable list. The number of data items supplied must be the<br />

same as the number of variables in the list.<br />

The variable names in the list may be numeric or string variable names (including subscripted<br />

variables). The type of each data item input must agree with the type specified by the variable<br />

name.<br />

Too many or too few data items, or the wrong type of values (for example, numeric instead of<br />

string), causes the message "?Redo from start" to be printed. No assignment of input values<br />

is made until an acceptable response is given.<br />

A comma may be used instead of a semicolon after prompt string to suppress the question mark.<br />

For example, the following line prints the prompt with no question mark:<br />

INPUT "ENTER BIRTHDATE",B$<br />

If the prompt string is preceded by a semicolon, the RETURN key pressed by the operator is<br />

suppressed. During program execution, data on that line is displayed, and data from the next<br />

PRINT statement is added to the line.<br />

When an INPUT statement is encountered during program execution, the program halts, the<br />

prompt string is displayed, and the operator types in the requested data. Strings that input to an<br />

INPUT statement need not be surrounded by quotation marks unless they contain commas or<br />

leading or trailing blanks.<br />

When the operator presses the RETURN key, program execution continues.<br />

file:///C|/Documents%20and%20Settings/Lorenzo/Desktop/GW%20Basic/INPUT.html (1 of 2)28/03/2004 21.29.30

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!