Sinclair ZX81 User Manual page 32

Hide thumbs Also See for ZX81:
Table of Contents

Advertisement

30 IF A$<=B$ THEN GOTO 70
40 LET C$=A$
50 LET A$=B$
60 LET B$=C$
70 PRINT A$;" ";("<" AND A$<B$)+("=" AND A$=B$);" ";B$
80 GOTO 10
6. Try this program:
10 PRINT "X"
20 STOP
30 PRINT "Y"
When you run it, it will display "X" & stop with report 9/20. Now type
CONT
You might expect this to behave like ' GOTO 20', so that the computer would just stop again without
displaying "Y"; but this would not be very useful, so things are arranged so that for reports with code
( STOP statement executed), the line number is increased by 1 for a CONT statement. This in our example,
' CONT ' behaves like ' GOTO 21' (which, since there are no lines between 20 & 30, behaves like ' GOTO
30').
7. Many versions of BASIC (but not the ZX81 BASIC) have an ON statement, which takes the form
ON numeric expression GOTO line number, line number,...,line number In this the numeric expression is
evaluated; suppose its value is n then the effect is that of.
GOTO the nth line number
For instance
ON A GOTO 100, 200, 300, 400, 500
Here, if A has the value 2, then 'GOTO 200' is executed. In ZX81 BASIC this can be replaced by
GOTO 100*A
In case the line numbers don't go up neatly by hundreds like this, work out how you could use
GOTO a conditional expression
instead.

Hide quick links:

Advertisement

Table of Contents
loading

Table of Contents