Sharp OZ-707 Operation Manual - Page 98

FORMAT, Abbreviation, PURPOSE, REMARKS, EXAMPLE

Page 98 highlights

ON ... GOTO p FORMAT: ON s· n GOTO {line number 1} {line number 2} expres 10 *Iabel 1 ' *Iabel 2 , ... Abbreviation: O. G. See Also: GOSUB, GOTO, ON ...GOSUB PURPOSE: Transfers control to one of a set of locations, depending on the value of a control expression. REMARKS: When ON...GOTO is executed the expression between ON and GOTO is evaluated and reduced to an integer. If the value of the integer is 1, control is transferred to line number 1 or :l

  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  • 32
  • 33
  • 34
  • 35
  • 36
  • 37
  • 38
  • 39
  • 40
  • 41
  • 42
  • 43
  • 44
  • 45
  • 46
  • 47
  • 48
  • 49
  • 50
  • 51
  • 52
  • 53
  • 54
  • 55
  • 56
  • 57
  • 58
  • 59
  • 60
  • 61
  • 62
  • 63
  • 64
  • 65
  • 66
  • 67
  • 68
  • 69
  • 70
  • 71
  • 72
  • 73
  • 74
  • 75
  • 76
  • 77
  • 78
  • 79
  • 80
  • 81
  • 82
  • 83
  • 84
  • 85
  • 86
  • 87
  • 88
  • 89
  • 90
  • 91
  • 92
  • 93
  • 94
  • 95
  • 96
  • 97
  • 98
  • 99
  • 100
  • 101
  • 102
  • 103
  • 104
  • 105
  • 106
  • 107
  • 108
  • 109
  • 110
  • 111
  • 112
  • 113
  • 114
  • 115
  • 116
  • 117
  • 118
  • 119
  • 120
  • 121
  • 122
  • 123
  • 124
  • 125
  • 126
  • 127
  • 128

ON ... GOTO
p
FORMAT:
ON
s· n GOTO {line number
1}
{line number
2}
expres
10
*Iabel 1
' *Iabel 2
,...
Abbreviation:
O.
G.
See
Also:
GOSUB, GOTO,
ON
...
GOSUB
PURPOSE:
Transfers control to one of a set of locations, depending
on
the value
of a control expression.
REMARKS:
When ON ... GOTO
is
executed the expression between ON and GOTO
is
evaluated and reduced to an integer. If the value of the integer is 1,
control
is
transferred to line number 1 or
:l<Iabel
1
in
the
list. If the
expression is
2,
control
is
transferred to line number 2 or *Iabel 2
in
the list, and
so
forth.
Note:
Be sure to place a space just before the GOTO command. Otherwise it
may be regarded
as
a variable.
If the expression
is
zero, negative, or larger than the number of line
numbers provided
in
the list, execution proceeds with the next
statement or line of the program.
An error occurs
if
the value of the expression is
-32769
or less or
32768 or more.
Use commas
(,)
to separate line numbers or *Iabels
in
the list.
184
EXAMPLE:
10: INPUT A
20:
ON
A GOTO 100,200,300
30: GOTO 900
100: PRINT "FIRST"
110: GOTO 900
200: PRINT "SECOND"
210: GOTO 900
300: PRINT "THIRD"
310: GOTO 900
900:
END
An
entry
of
1 displays
"FIRSr
; 2
displays
"
SECOND";
3
displays
"THIRD
".
Any
other
entry
does
not
produce
any
display
.
185