WAIT*
Suspend program processing until a key is pressed
Syntax
WAIT [<expPrompt>] [TO <idVar>]
Arguments
<expPrompt> is an expression of any data type displayed as a prompt. If no <expPrompt> is specified, the default prompt displayed is: “Press any key to continue…”
TO <idVar> is the variable, of any storage class, that holds the value of the key pressed as a character value. If <idVar> does not exist or is not visible, it is created as a private variable and then assigned the character value.
Description
WAIT is a console command and wait state that displays a prompt after sending a carriage return/line feed to the screen. It then waits for the user to press a key. If the TO clause is specified, <idVar> is assigned the keystroke as a character value. If an Alt or Ctrl key is pressed, WAIT assigns CHR(0) to <idVar>. Non-alphanumeric values entered by pressing an Alt-keypad combination assign the specified character. If the character can be displayed, it is echoed to the screen. Function keys are ignored unless assigned with SET FUNCTION or SET KEY.
WAIT is a compatibility command and, therefore, is not recommended for general usage. It is superseded by both @…GET/READ and INKEY() for getting single character input.
Notes
. WAITing without a prompt: To pause execution without displaying a prompt, specify WAIT, null string (“”), or INKEY(0). The latter is recommended since it does not disturb the current screen cursor position.
Examples
. This example illustrates how to store the WAIT keystroke as an array element: aVar := ARRAY(6) WAIT "Press a key..." TO aVar[1] ? aVar[1] // Result: key pressed in // response to WAIT ? aVar[2] // Result: NIL ? VALTYPE(aVar) // Result: A ? VALTYPE(aVar[1]) // Result: C
Seealso
@…GET, ACCEPT*, INKEY(), INPUT*, MENU TO