mk90.basic.functions

Function INKEY

Poll one translated keyboard event.

Syntax

INKEY

Returns

Translated character/control code, or 0 when no event is available.

Behavior

Uses the OS nonblocking keyboard path, which also cooperates with the scheduler and display. It exposes events and repeats rather than a matrix of simultaneously held keys.

The runtime separately polls for cancellation every 32 opcodes. Those polls can consume ordinary events before INKEY sees them. Code 3 is also returned by up-arrow and used to cancel the runtime.

Example

10 A=INKEY
20 IF A=0 THEN 10
30 PRINT A
40 END

Limits and diagnostics

No trailing $ and no parentheses. It is not the string-valued INKEY$ found in other BASICs.

Status-code reference.

See also

Expressions and precedence · Runtime