in statement

The in statement accepts a single raw character of input from the keyboard, without displaying a prompt character or requiring pressing ENTER following the input.

Note: For Windows: Null input is not supported.


in var{for time.exp then|else statement.block}


time.exp Specifies the maximum amount of time that the system waits for input before returning to the FlashBASIC or BASIC program.
  • When a character is entered, the then clause is taken.

  • When a character is not entered in the allocated time, the else clause is taken.


A character is retrieved from the type-ahead buffer without being processed and is converted to its equivalent decimal value before being assigned to the variable.

For example, when the BACKSPACE key is pressed, the in statement retrieves an 8. When the LINEFEED key is pressed, the value is 10.

The time expression is expressed in tenths of a second, as a positive integer from 1 to 32767. If time.exp is zero and there is at least one character in the input buffer, the first character is returned and the then clause is taken. If time.exp is zero, and there is no character available in the input buffer, the in statement returns immediately and the else clause is taken. If time.exp is negative, then no time-out is in effect. The system waits indefinitely for the character.

A length.exp of zero is allowed in the input statement. This syntax is more consistent with other implementations of D3.

Note: The data statement cannot be used to pass data to the in statement.


This program loops until a carriage return (char(13)) is pressed.

in key
until key = 13 do repeat

In this example, the system waits for key for 30 seconds. If no keystroke is provided within 30 seconds, time-out occurred displays and the program stops.

maxtime = 300 ;* 30 seconds
in key for maxtime else
   crt ’time-out occurred’

input x,0
x = seq(x)

These two lines perform exactly the same as:

in x