Get the next key code in the buffer without extracting it.
// Use NEXTKEY() with INKEY() to change display characters, or by
// itself to exit the loop, so that the caller can detect the Esc.
LOCAL nKey, cChar := "+"
WHILE TRUE
?? cChar
nKey := NEXTKEY()
IF nKey == K_ESC
EXIT
ELSE
IF nKey != 0
cChar := CHR( nKey )
END IF
END IF
END WHILE
Tests
KEYBOARD "AB"; ? NEXTKEY(), NEXTKEY() ==> 65 65