INPUT

INPUT*

Enter the result of an expression into a variable

Syntax

      INPUT [<expPrompt>] TO <idVar>

Arguments

<expPrompt> is an optional prompt displayed before the input area. The prompt can be an expression of any data type.

TO <idVar> specifies the name of the variable to be assigned the evaluation result. If <idVar> is not visible or does not exist, a private variable is created and assigned the result.

Description

INPUT is a console command and wait state that takes entry from the keyboard in the form of a valid expression of up to 255 characters and any data type. When invoked, INPUT sends a carriage return/linefeed to the screen, displays the prompt, and begins accepting keyboard input at the first character position following the prompt. Input greater than MAXCOL() wraps to the next line.

Pressing Return terminates entry of the expression. The expression is then compiled and evaluated using the macro operator (&), and the result assigned to <idVar>. If the variable is not visible or does not exist, it is created as a private. If no expression is entered, no action is taken.

INPUT supports only two special keys: Backspace and Return. Esc is not supported. Backspace deletes the last character typed. Return confirms entry and is the only key that can terminate an INPUT.

Examples

      .  In this example INPUT assigns a keyboard entry to an existing
         local variable:
         LOCAL exp
         INPUT "Expression: " TO exp
         IF exp != NIL
            ? exp
         ELSE
            ? "No expression entered"
         ENDIF
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s