Commands and Statements

Command INPUT Foundation

Assigns the value of an input expression to a variable.

INPUT [<SayExpression>] TO <VarName>
<SayExpression> can be specified. The expression can provide a value of character, numeric, date or logical data type. It is displayed in front of the input area.
The value of the input expression is assigned to the variable <VarName> specifies. If the variable is not declared, a PRIVATE variable with this name is created.

The command INPUT allows keyboard input of characters and assigns the value of the input expression to a variable. It is a simple input routine which first outputs the control characters carriage-return line-feed (Chr(13)+Chr(10)) so the cursor appears at the beginning of the screen row. <SayExpression> is then displayed and the command waits for keyboard input by the user.

The input characters are compiled using the macro operator and the resulting value is assigned to the variable <VarName> after the Return key is pressed. This key is the only one which can be used to terminate input. The Esc key is not supported. Only backspace and the left/right arrow keys are supported as editing keys.

Any number of characters can be input. When the cursor reaches the right screen margin, it wraps to the start of the following row. If the input characters cannot be compiled with the macro operator, a runtime error occurs.

The command INPUT exists only for compatibility reasons. User input should be performed using @...SAY or @...GET instead of INPUT.

// The example shows various ways to call the 
// command INPUT 

   LOCAL cVar 

   INPUT "Input:"  TO cVar 

   INPUT 12345     TO cVar 

   INPUT Date()    TO cVar 

   INPUT .T.       TO cVar 

   INPUT           TO cVar 


If you see anything in the documentation that is not correct, does not match your experience with the particular feature or requires further clarification, please use this form to report a documentation issue.