Sharp MZ-700 Series Owner's Manual page 60

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

Advertisement

2.3.8 Remark statement and control commands
2. 3. 8. 1 REM
Format
Function
REM r
r . . . . Programmer's remark
REM is a non-executable statement which is specified in a program line t o cause
the BASIC interpreter to ignore the remainder of that line. Since REM statements
are non-executable, they may be included at any point in the program without
affecting the results of execution. REM statements are generally used to m a k e a
program easier to read, or to add explanatory notes t o a program.
Multiple statement program lines
When m o r e than one statement is included on a single program line, each statement m u s t be
separated f r o m the one preceding it b y a colon (:). Operation of the BASIC interpreter is
generally the same in such cases as w h e n the same statements are specified o n different lines.
F o r example, the two programs below produce exactly the same result.
1 0
A = 5
2 0
B = 8
3 0
C = A X B
4 0
P R ! N T
C
1 0
A = 5 : B = 8 : C = A X B :
P R I N T
C
Note: Also n o t e that program operation may differ when multiple statement lines are used as
shown below.
1 0
I N P U T
A
2 0
B = 0
3 0
I F
9 9 < A
T H E N
B = 1
4 0
P R I N T
B
5 0
E N D
This program displays 1 if the value entered at
line 10 is greater than or equal to 100, and 0
if the value entered is less than 100.
1 0
I N P U T
A : B = 0 :
I F
9 9 < A
T H E N
B = 1 : P R I N T
B
2 0
E N D
This program displays 1 if the value entered is greater than or equal to 100, b u t nothing
at all if the value entered is less than 100. The reason for this is that statements follow-
ing THEN on line 10 are n o t executed if the I F condition is n o t satisfied.
58

Advertisement

Table of Contents
loading

Table of Contents