13.07.2015 Views

Turbo Basic

Turbo Basic

Turbo Basic

SHOW MORE
SHOW LESS
  • No tags were found...

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

KEY(n) statementFunctionSyntaxRemarksKEY(n) turns trapping on or off for a specifIc key.KEY(n) {ONIOFFISTOP}n is the trapped key, an integer expression from 1 to 25, accordingto the following:nKey1-10 Function keys 1-1011 Cursor Up12 Cursor Left13 Cursor Right14 Cursor Down15-25 Keys defined byKEY statementSee AlsoExampleKEY(n) ON turns on trapping of key n. This means that a check ismade between every statement to see if key n has been pressed;and if it has, program execution is diverted to the routine specifIedin an ON KEY statement for that key.KEY(n) OFF disables trapping of key n.KEY(n) STOP also disables key trapping but remembers theoccurrence of KEY (n) pressing, so that if a KEY ON statement issubsequently executed, a trap occurs immediately.$EVENTON KEYI turn on key checkingKEY ONI assign strings to keysKEY I, "Hello" + CHR$(13)KEY 2, "GoodBye" + CHR$(l3)KEY 10, CHR$(13)I set up a key trap for FlOI assign a string to it.ON KEY(10) GOSUB GoodByeI turn on FlO trappingKEY(lO) ONI get user's inputINPUT "Press Fl: ";Dummy$INPUT "Press F2: ";Dummy$<strong>Turbo</strong> <strong>Basic</strong> Reference Directory 239

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!