Suspend program processing until a key is pressed
WAIT [<expPrompt>] [TO <idVar>]
<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.
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.
. 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.
. This example illustrates how to store the WAIT keystroke as an array element: aVar := ARRAY(6) WAIT "Press a key..." TO aVar ? aVar // Result: key pressed in // response to WAIT ? aVar // Result: NIL ? VALTYPE(aVar) // Result: A ? VALTYPE(aVar) // Result: C
@…GET, ACCEPT*, INKEY(), INPUT*, MENU TO