Sharp MZ-700 Basic Manual page 90

Disk basic interpreter
Hide thumbs Also See for MZ-700:
Table of Contents

Advertisement

92
5.1.9
Branch Statements
GOTO
GOSUB -
RETURN
IF - THEN
IF - GOTO
IF - GOSUB
ON- GOTO
ON-
GOSUB
100 GOTO 200
100 GOSUB 700
800 RETURN
Jumps to statement number
200 (=
movement of program
execution).
Branches to statement number
700
subroutine (calling of
subroutine). Ends subroutine execution by RETURN
statement, and returns to statement following GOSUB
command in the main program.
10 IF A>20 THEN
Jumps to statement number
200
if variable
A
is larger
200
than
20.
Executes next statement if A is
20
or less.
50 IF B<3 THEN B
Substitutes B
+
3 for variable B if variable B is less than
=B+3
100 IF A>=B GO
TO 10
3. Executes next statement if B is 3 or greater.
Jumps to statement number
10
if variable A is equal to or
greater than variable B. Executes next statement if A is
less than B.
30 IF A=B
*
2 GO
Branches to statement number
90
subroutine if value of
SUB 90
variable
A
is equal to twice the value of B. If not,
executes next statement.
(If there is a multi-statement following a conditional
statement, the ON statement is executed when the
condition is not reached, but the IF statement moves the
execution to the next statement number if the condition is
not reached, and the multi-statement is ignored.)
50 ON A GOTO 70,
Jumps to statement number
70
if variable
A
is
1,
to
80. 90
statement number
80
if it is
2,
and to statement number
90
if it is 3. The next statement is executed if A is 0 or 4 or
more. The INT function is included in ON, so jumps to
statement number
80
if
A
is
2.7,
in the same way as
2.
90 ON A GOSUB
700. 800
Branches to statement number
700
subroutine if variable
A is 1, and to statement number 800 if it is 2. The next
statement is executed if A is 0 or 3 or more.

Hide quick links:

Advertisement

Table of Contents
loading

This manual is also suitable for:

Mz-2z009

Table of Contents