Sharp mz-800 Owner's Manual page 79

Hide thumbs Also See for mz-800:
Table of Contents

Advertisement

IF~GOTO
Format
Explanation
Example
IF | <relational expression>| GOTO | <line number>
| <logical expression>
|
| <label >
Abbreviated Format
IF~G.
The IF ~ GOTO statement sequence evaluates the condition defined by <relational
or logical expression > , then branches to the line number specified in <line number>
or <label>
if the condition is satisfied. As with the IF~THEN
sequence,
IF ~ GOTO is used for conditional branching. When the specified condition is satis-
fied, the program execution jumps to the line number specified in <line number >
or <label>.
If the condition is not satisfied, execution continues with the next line
of the program. (Any statements following IF~ GOTO on the same program line
will be ignored.)
10
T=0:N=0
20 INPUT ''VALUE='';X
30 IF X=999 GOTO 100
40 T=T+X:N=N+1
50 GOTO 20
100 PRINT '*####
eee RHR"
110 PRINT "'TOTAL:";T
120 PRINT ''NO. ENTRIES:'';N
130 PRINT "'AVERAGE:"';T/N
140 END
The above example gives the total and average of input values. If 999 is input, pro-
gram execution is terminated.
GOTO
IF ~ THEN ~ :ELSE
IF ~GOSUB
6-22

Advertisement

Table of Contents
loading

Table of Contents