GOTO |
[Features] It jumps to the
specified line.
[Format] GOTO
|linenumber or label|
[Explanation]
All the
jump positions is specified with a linenumber or a label.
[e.g.]
GOSUB RETURN |
[Features] A subroutine is
called.
[Format] GOSUB
|linenumber or label| : RETURN
[Explanation]
It
returns to the next place of 'gosub' by 'return'.
[e.g.]
IF THEN ELSE ENDIF |
[Features] Condition
judgment.
[Format] IF
expression THEN statements [ELSE statements]
[Explanation]
'expression' is the formula of judgment of truth.
e.g. expression
a=5 ' A and 5 are equal.
(a<5 and b<>8) ' a is
smaller than 5 and, B and 8 aren't equal.
If it is true(-1), the statement after
'THEN' will be executed.
If it is
false(0), the statement after 'ELSE' will be executed.
Block'IF-ENDIF' can also be used.
It is written by the plural lines, and
rounded off with 'ENDIF'.
Separator in the
block structure 'ELSE''ENDIF' must be a simple sentence in line.
[e.g.]
10 if a=b then
20 print"true"
30 else
40 print"false"
50 endif
100 if a mod 2=0 then print"Even" else
print"Odd"
FOR NEXT |
[Features] Loop processing by a
count is performed.
[Format] FOR
variable=A TO B [step C] : NEXT
[Explanation]
It is
repeated, 'variable' between 'A' and 'B'.
If it comes to 'next', additional value'C' is added to the variable, and
loop.
Multiplex nest is possible.
If conditions don't suit, the inside of a
loop isn't executed once.
It's
possible to use a decimal for loop counter(value).
[e.g.]
for i=0 to 16 step 2
print i;
next
(Result)
0 2 4 6 8 10 12 14
16
WHILE WEND |
[Features] A formula performs
loop processing between truth.
[Format] WHILE expression : WEND
[Explanation]
While expression is true(-1), loop statements are executed until the 'WEND'.
If it is false(0), execution line is
consists of the statement following the 'WEND'.
Multiplex nest is possible.
[e.g.]
while i<8
i=i+1
print
i;
wend
(Result)
1 2 3 4 5 6 7
REPEAT UNTIL |
[Features] To return to repeat
part by the condition of expression.
[Format] REPEAT : UNTIL expression
[Explanation]
When <expression> is false(0), it go
back to 'REPEAT'.
When <expression> is true(-1), it
exit the loop, and go to next statement.
Since judged by
'UNTIL', inside the loop will be executed certainly once.
Multiplex nest is possible.
[e.g.]
repeat
i=i+1
print i;
until
i=5
(Result)
1 2 3 4
5
ON GOTO,GOSUB |
[Features] Execution jumps to
the linenumber placed the n-th.
[Format] ON n | GOTO or GOSUB |
linenumber[,linenumber]...
[Explanation]
When describing 'GOTO', to jump only.
When describing 'GOSUB', to come back by 'RETURN' command and
execution moves to the next of this
command.
[e.g.]
10 input n
20 on n goto
110,120,130
100 print 0:end
110 print 1:end
120 print
2:end
130 print 3:end
BREAK |
[Features] It escapes from the
latest loop.
[Format]
[Explanation]
[e.g.]
while i<8
print i;
if i=4 then break
i=i+1
wend
(Result)
0 1 2 3 4
CONTINUE |
[Features] It shifts to the next
turn in a loop.
[Format]
[Explanation]
[e.g.]
for
i=1 to 8
if i=4 then continue
print i;
next
(Result)
1 2 3 5 6 7 8