On (Expression) Gosub - AMSTRAD cpc 6128 User Instruction

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

Advertisement

ON
<expression>
GOSUB
ON <selector> GO SUB <list of: <line number>
10 PAPER 0:PEN 1:INK 0,1
20 CLS:PRINT "MENU OF OPTIONS":PRINT
30 PRINT "1 - Change border":PRINT
40 PRINT "2 - Change pen":PRINT
50 PRINT "3 - Change mode":PRINT
60 INPUT "Enter your selection";x
70 ON x GOSUB 90,110,130
80 GOTO 20
90 b=b-1:IF b<0 THEN b=26
100 BORDER b:RETURN
110 p=p-1:IF p<2 THEN p=26
120 INK 1,p:RETURN
130 m=m-1:IF m<0 THEN m=2
140 MODE m:RETURN
run
COMMAND: Selects a sub-routine 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 90,
selecting 2jumps to line 110,and3jumpstoline 130.
If the value of the <selector> is zero, or is higher than the amount of <line number>s
listed in the command, then no sub-routine line will be selected.
Associated keywords: RE T URN
Complete List of Keywords
Chapter 3 Page 51

Advertisement

Table of Contents
loading

Table of Contents