Sharp MZ-700 Series Owner's Manual page 52

Personal computer
Hide thumbs Also See for MZ-700 Series:
Table of Contents

Advertisement

Note
The syntax of BASIC imposes no limit on the extent to which subroutines can be
nested (that is, on the number of levels of subroutine calls which can be made f r o m
other subroutines); however, in practice a limitation is imposed by the a m o u n t of
free space in m e m o r y which is available f o r storing return addresses.
10
B = 5
20 C = 8
3 0 GOSUB
100
4 0 P R I N T
A
SO
B - 2
6 0
C = 10
70 G O S U B 100
80 P R I N T
A
90
E N D
100
A = B + G
I IO R E T U R N
B = 5
c = 8
O
( G 0 S U B I 0 q > = ^ \
•>Q oo~)
A = B + C
< R E T U R N )
< 0
G O S U B ( 0 0
r '
-A-
P R I N T A
12 displayed.
0
2 . 3 . 6 . 4 IF
Format
Function
THEN
(abbreviated f o r m a t : . . . I F ~ TH.)
IF e THEN Ln
I F e THEN statement
e:
A relational expression or logical expression
Ln: Destination line n u m b e r
I F . . . THEN statements are used to control branching of program execution accord-
ing to the result of a logical or relational expression. When the result of such an
expression is true, statements following THEN are executed. If a line n u m b e r is
specified following THEN, program execution j u m p s to that line of the program if
the result of the expression is true.
If the result of the logical or relational expression is false, execution continues with
the program line following that containing the IF . . . THEN statement.
IF
Condition
THEN
Statement or line number
50

Advertisement

Table of Contents
loading

Table of Contents