On (Expression) Goto; On Sq Gosub - AMSTRAD cpc 6128 User Instruction

Integrated computer/disc system
Hide thumbs Also See for cpc 6128:
Table of Contents

Advertisement

ON
<expression>
GOTO
ON <selector> GOT 0 <list of: <line number>
10 CLS:PRINT "MENU OF OPTIONS":PRINT
20 PRINT "1 - List program":PRINT
30 PRINT "2 - Edit and add":PRINT
40 PRINT "3 - CataLog disc":PRINT
50 INPUT "Enter your seLection";n
60 ON n GOTO 80,90,100
70 GOTO 10
80 LIST
90 AUTO
100 CAT
run
COMMAND: Selects a line to jump to, depending upon the value of the <selector>,
which should be a positive integer expression in the range 0 to 255. The order of the
<selector> values determines the <line number> to be selected from the <list of: <line
number>s. In the above example, selecting 1 makes BASIC jump to line
80,
selecting
2 jumps to line
90,
and 3 jumps to line
1 0 0.
If the value of the <selector> is zero, or is higher than the amount of <line number>s
listed in the command, then no line will be selected.
Associated keywords:
none
ONSQGOSUB
ON S
Q
«channel» GO SUB <line number>
10 ENV1,15,-1,1
20 ON SQ(1) GOSUB 60
30 MODE 0:0RIGIN 0,0,200,440,100,300
40 FOR x=1 TO 13:FRAME:MOVE 330,200,x
50 FILL x:NEXT:GOTO 40
60 READ s:IF s=0 THEN RESTORE:GOTO 60
70 SOUND 1,s,25,15,1
80 ON SQ(1) GOSUB 60:RETURN
90 DATA 50,60,90,100,35,200,24,500,0
run
Chapter 3 Page 52
Complete List of Keywords

Advertisement

Table of Contents
loading

Table of Contents