Tandy 1000 Basic Reference Manual page 229

Hide thumbs Also See for 1000:
Table of Contents

Advertisement

Chapter 10 I BASIC Keywords
Example
1 0 C O M ( 1 )
ON
2 0 0 ON COM(1
1 GOSUB 1 0 0 0
Line 10 turns on communication trapping on Channel 1. After
each program statement is executed, BASIC checks to see if the
communication buffer contains characters. If it does, BASIC im-
mediately executes the subroutine beginning at Line 1000.
1 0 C O M ( 1 )
ON
2 0 ON COMC1) GOSUB 1 0 0 0
3 0 FOR
I
=
1 TO 1 0
4 0
P R I N T I
5 0 N E X T
I
1 0 0 0
'
S U B R O U T I N E CODE
1 0 5 0 R E T U R N 2 0 0
If activity occurs on Communication Channel 1 while the FOR/
NEXT loop is executing, BASIC immediately executes the sub-
routine beginning
at
Line 1000. But the subroutine returns to
Line 200 instead of completing the FORiNEXT loop. This results
in a "For without next" error because any GOSUB, FOR, or
WHILE statement remains active during key trapping.
If the RETURN statement does not include a line number, pro-
gram control returns to complete the FOR/NEXT loop, and no
error occurs.
227

Hide quick links:

Advertisement

Table of Contents
loading

Table of Contents