ON KEY(n) Statement Details Syntax ON KEY(n) GOSUB {linelabel | linenumber} Keys are processed in the following order: 1. The line printer's echo-toggle key is processed first. Defining this key as a user-defined key trap does not prevent characters from being echoed to the line printer when pressed. 2. Function keys and the cursor-direction keys are examined next. Defining a FUNCTION key or DIRECTION key as a user-defined key trap has no effect because these keys are predefined. The ON KEY statement can trap any key, including BREAK or system reset. This makes it possible to prevent accidentally breaking out of a program or rebooting the machine. Note: When a key is trapped, the key event is destroyed. You cannot subsequently use INPUT or INKEY$ statements to find out which key caused the trap. Because there is no way to know which key press caused the branch to the trap, you must set up a subroutine for each key if you want to assign different functions to particular keys.