[Prev] [Next] [Contents] [Commodore] [New] [Search] [Home]


TYPE: Statement
FORMAT: INPUT [ "<prompt>" ; ] <variable list>

Action: This is a statement that lets the person RUNning the program "feed" information into the computer. When executed, this statement PRINTs a question mark (?) on the screen, and positions the cursor 1 space to the right of the question mark. Now the computer waits, cursor blinking, for the operator to type in the answer and press the <RETURN> key.

The word INPUT may be followed by any text contained in quote marks (""). This text is PRINT on the screen, followed by the question mark. After the text comes a semicolon (;) and the name of one or more variables separated by commas. This variable is where the computer stores the information that the operator types. The variable can be any legal variable name, and you can have several different variable names, each for a different input.

EXAMPLES of INPUT Statement:
   100 INPUT A
   110 INPUT B, C, D
   120 INPUT "PROMPT"; E

When this program RUNs, the question mark appears to prompt the operator that the Commodore 64 is expecting an input for line 100. Any number typed in goes into A, for later use in the program. If the answer typed was not a number, the ?REDO FROM START message appears, which means that a string was received when a number was expected.

If the operator just hits <RETURN> without typing anything, the vari- able's value doesn't change.

Now the next question mark, for line 110, appears. If we type only one number and hit the <RETURN>, Commodore 64 will now display 2 question marks (??), which means that more input is required. You can

[Prev] [Next] [Contents] [Commodore] [New] [Search] [Home]
This page has been created by Sami Rautiainen.
Read the small print. Last updated November 14, 1998.