IN


The IN statement allows the program to receive raw data from the input device, which is normally the terminal keyboard, one character at a time.

 

COMMAND SYNTAX

IN Var {FOR expression THEN|ELSE statements}

 

SYNTAX ELEMENTS

Var will be assigned the numeric value (0 - 255 decimal) of the next character received from the input device. The statement will normally wait indefinitely (block) for a character from the keyboard.

Specifying the FOR clause to the IN statement allows the statement to stop waiting for keyboard after a specified amount of time. The expression should evaluate to a numeric value, which will be taken as the number of deci-seconds (tenths of a second) to wait before abandoning the input.

The FOR clause must have either or both of the THEN or ELSE clauses. If a character is received from the input device before the time-out period then Var is assigned its numeric value and the THEN clause is executed (if present). If the input statement times out before a character is received then Var is unaltered and the ELSE clause is executed (if present).

 

NOTES

See also INPUT, INPUTNULL.

 

EXAMPLES

Char2 = "
IN Char
IF Char = 27 THEN ;* ESC seen
    IN Char2 FOR 20 THEN ;* Function Key?
        Char2 = CHAR(Char2) ;* ASCII value
    END
END
Char = CHAR(Char):Char2 ;* Return key sequence


jBC